cadence-client icon indicating copy to clipboard operation
cadence-client copied to clipboard

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

Open tomatopunk opened this issue 11 months ago • 0 comments

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.

tomatopunk avatar Nov 14 '24 06:11 tomatopunk