kubemq-io / kubemq-go

go library for kubemq server
Apache License 2.0
47 stars 16 forks source link

RPC error when sending to QueuesStreamClient #16

Closed natnoc closed 1 year ago

natnoc commented 1 year ago

Hi,

I occasionally get the following error: rpc error: code = Unknown desc = stan: connect request timeout (possibly wrong cluster ID?)

Until now, I haven't quite found a pattern for this error to occur, but it is thrown after calling queuesClient.Send:

// this code is called in main.go, closing of client connection is deferred
queuesClient, err := kubemq.NewQueuesStreamClient(ctx,
        kubemq.WithAddress(host, grpcPort),
        kubemq.WithClientId(clientId),
        kubemq.WithTransportType(kubemq.TransportTypeGRPC))
    if err != nil {
        return nil, err
    }

...

// this code is called when a specific event occurs and errors occasionally.
res, err := queuesClient.Send(ctx, kubemq.NewQueueMessage().
        SetChannel(channel).SetMetadata(msg.Metadata).SetBody(msg.Body).SetTags(msg.Tags))
    if err != nil {
        logger.GetLogger(ctx).Error().Caller().Err(err).Send()
        return nil, err
    }

...

I have multiple services running in a minikube cluster in their own namespace and KubeMQ deployed with Helm according to the docs. The services are deployed with Helm managed by Tilt for local development. All pods seem to be healthy, but I do see the exact same error message in either one of the kubemq-cluster pods.

Any ideas on what causes this error?

natnoc commented 1 year ago

K8s version: 1.26.3

Go version: 1.20

KubeMQ Helm chart versions: image

kubemq commented 1 year ago

Not sure this is go sdk issue, please contact us on our slack channel.

natnoc commented 1 year ago

It appears that the error was caused by an invlid license key, just in case anyone else struggles with this. Thanks for the quick support!