Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution Issue on Apple Silicon with Cadence Client Versions 1.2.8 and 1.2.9 #1402

Open
tomatopunk opened this issue Nov 14, 2024 · 0 comments

Comments

@tomatopunk
Copy link

tomatopunk commented Nov 14, 2024

Describe the bug
A clear and concise description of what the bug is.

I found a very unormal question.

I tested the Cadence client versions 0.19.0, 1.2.8, and 1.2.9. The issue does not occur in version 0.19.0, but it is consistently reproducible in versions 1.2.8 and 1.2.9.

When I import go.uber.org/cadence/worker, the compiled Go program cannot be executed. However, if I use go run main.go, it executes normally.

I tested on Ubuntu 22.04 using Docker (both ARM and AMD architectures), and there were no issues. This problem might be specific to Apple Silicon.

To Reproduce
Is the issue reproducible?

  • [Yes]

Steps to reproduce the behavior:
A clear and concise description of the reproduce steps.

  1. add init work code
  2. go build
  3. run

Expected behavior
A clear and concise description of what you expected to happen.

should be execute.

Screenshots
If applicable, add screenshots to help explain your problem.

image

Additional context
Add any other context about the problem here, E.g. Stackstace, workflow history.

test code:

package main

import (
	"fmt"
	apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
	"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
	"go.uber.org/cadence/compatibility"
	_ "go.uber.org/cadence/worker"
	"go.uber.org/yarpc"
	"go.uber.org/yarpc/transport/grpc"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
	"net/http"
)

var HostPort = "192.168.239.180:31164"
var Domain = "default"
var TaskListName = "test-worker"
var ClientName = "test-worker"
var CadenceService = "cadence-frontend"

func main() {
	defer func() {
		if r := recover(); r != nil {
			fmt.Println("Recovered in :", r)
		}
	}()
	fmt.Println("hello world")
	buildCadenceClient()
	//startWorker(buildLogger(), buildCadenceClient())
	err := http.ListenAndServe(":8080", nil)
	if err != nil {
		panic(err)
	}

	//StartWorker()
}

func buildLogger() *zap.Logger {
	config := zap.NewDevelopmentConfig()
	config.Level.SetLevel(zapcore.InfoLevel)

	var err error
	logger, err := config.Build()
	if err != nil {
		panic("Failed to setup logger")
	}

	return logger
}

func buildCadenceClient() workflowserviceclient.Interface {
	dispatcher := yarpc.NewDispatcher(yarpc.Config{
		Name: ClientName,
		Outbounds: yarpc.Outbounds{
			CadenceService: {Unary: grpc.NewTransport().NewSingleOutbound(HostPort)},
		},
	})
	if err := dispatcher.Start(); err != nil {
		panic("Failed to start dispatcher")
	}

	clientConfig := dispatcher.ClientConfig("cadence-frontend")

	return compatibility.NewThrift2ProtoAdapter(
		apiv1.NewDomainAPIYARPCClient(clientConfig),
		apiv1.NewWorkflowAPIYARPCClient(clientConfig),
		apiv1.NewWorkerAPIYARPCClient(clientConfig),
		apiv1.NewVisibilityAPIYARPCClient(clientConfig),
	)
}

//func startWorker(logger *zap.Logger, service workflowserviceclient.Interface) {
//	// TaskListName identifies set of client workflows, activities, and workers.
//	//////It could be your group or client or application name.
//	//workerOptions := worker.Options{
//	//	Logger: logger,
//	//	//MetricsScope: tally.NewTestScope(TaskListName, map[string]string{}),
//	//}
//	//
//	//_ = workerOptions
//
//	//worker := worker.New(
//	//	service,
//	//	Domain,
//	//	TaskListName,
//	//	worker.Options{})
//	//err := worker.Start()
//	//if err != nil {
//	//	panic("Failed to start worker")
//	//}
//}


I am quite confused. When I import the work package, the main function cannot be executed. I reviewed the work package but couldn't find any reasons for the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant