309791679 opened a new issue, #1194:
URL: https://github.com/apache/rocketmq-clients/issues/1194

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
   
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq-clients/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Programming Language of the Client
   
   Go
   
   ### Runtime Platform Environment
   
   win11 go 1.25.3
   
   
   
   
   ### RocketMQ Version of the Client/Server
   
   RocketMQ/golang/v5 v5.1.3    Version V5_3_2
   RocketMQ/golang v2 v2.1.2
   
   ### Run or Compiler Version
   
   _No response_
   
   ### Describe the Bug
   
   go v5.1.3 此版本总会报错 
   
   ### Steps to Reproduce
   
   package main
   
   import (
        "context"
        "fmt"
        "log"
        "os"
        "time"
   
        "github.com/apache/rocketmq-client-go/v2"
        "github.com/apache/rocketmq-client-go/v2/primitive"
        "github.com/apache/rocketmq-client-go/v2/producer"
   
        golang "github.com/apache/rocketmq-clients/golang/v5"
   )
   
   func main() {
   
        p, err := rocketmq.NewProducer(
                producer.WithNameServer([]string{"192.168.110.200:9876"}),
                producer.WithRetry(2),
        )
        if err != nil {
                log.Fatal("Failed to create producer", err)
        }
   
        // Failed to start producer
        err = p.Start()
        if err != nil {
                log.Fatal("Failed to start producer:", err)
        }
        defer p.Shutdown()
   
        fmt.Println("✅ 4.x Producer started successfully")
   
        // 发送消息
        for i := 0; i < 3; i++ {
                msg := &primitive.Message{
                        Topic: "test-topic",
                        Body:  []byte(fmt.Sprintf("Hello RocketMQ %d", i)),
                }
                msg.WithTag("TagA")
   
                res, err := p.SendSync(context.Background(), msg)
                if err != nil {
                        log.Printf("Send failed: %v", err)
                } else {
                        fmt.Printf("✅ Send successful: %s\n", res.String())
                }
   
                time.Sleep(1 * time.Second)
        }
        v5()
   }
   
   func v5() {
        // 禁用 telemetry
        os.Setenv("ROCKETMQ_ENABLE_TELEMETRY", "false")
        os.Setenv("mq.consoleAppender.enabled", "false")
        golang.ResetLogger()
   
        endpoint := "192.168.110.200:18080"
        topic := "test-topic"
   
        fmt.Printf("tp RocketMQ: %s\n", endpoint)
        fmt.Printf("topic: %s\n", topic)
   
        // Failed to create producer
        producer, err := golang.NewProducer(&golang.Config{
                Endpoint: endpoint,
        }, golang.WithTopics(topic))
   
        if err != nil {
                log.Fatalf("Failed to create producer: %v", err)
        }
   
        // Start producer
        fmt.Println("Start producer...")
        if err := producer.Start(); err != nil {
                log.Fatalf("Start failed: %v", err)
        }
        defer producer.GracefulStop()
   
        fmt.Println("✅ Producer started successfully!")
   
        // 发送消息
        msg := &golang.Message{
                Topic: topic,
                Body:  []byte("Hello RocketMQ"),
        }
   
        ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
        defer cancel()
   
        resp, err := producer.Send(ctx, msg)
        if err != nil {
                log.Fatalf("Send failed: %v", err)
        }
   
        fmt.Printf("✅ Send successful: %s\n", resp[0])
   }
   
   
   
   
   ### What Did You Expect to See?
   
   All normal
   
   ### What Did You See Instead?
   
   ✅ 4.x Producer started successfully
   ✅ Send successful: SendResult [sendStatus=0, 
msgIds=C0A8B0019F24000000005c4955f00001, 
offsetMsgId=C0A86EC800002A9F000000000000081F, queueOffset=3, 
messageQueue=MessageQueue [topic=test-topic, brokerName=broker-a, queueId=1]]
   time="2026-02-18T22:05:10+08:00" level=info msg="change the route for 
clients"
   time="2026-02-18T22:05:10+08:00" level=info msg="the topic route info 
changed" 
changeTo="{\"OrderTopicConf\":\"\",\"queueDatas\":[{\"brokerName\":\"broker-a\",\"readQueueNums\":8,\"writeQueueNums\":8,\"perm\":6,\"topicSynFlag\":0}],\"brokerDatas\":[{\"cluster\":\"DefaultCluster\",\"brokerName\":\"broker-a\",\"brokerAddrs\":{\"0\":\"192.168.110.200:10911\"}}]}"
 changedFrom="<nil>" topic=test-topic
   ✅ Send successful: SendResult [sendStatus=0, 
msgIds=C0A8B0019F24000000005c4959d80002, 
offsetMsgId=C0A86EC800002A9F0000000000000906, queueOffset=3, 
messageQueue=MessageQueue [topic=test-topic, brokerName=broker-a, queueId=2]]
   ✅ Send successful: SendResult [sendStatus=0, 
msgIds=C0A8B0019F24000000005c495dc00003, 
offsetMsgId=C0A86EC800002A9F00000000000009ED, queueOffset=3, 
messageQueue=MessageQueue [topic=test-topic, brokerName=broker-a, queueId=3]]
   tp RocketMQ: 192.168.110.200:18080
   topic: test-topic
   Start producer...
   time="2026-02-18T22:05:13+08:00" level=info msg="The RMQClient stopping 
update topic route info." clientID=192.168.176.1@40740
   time="2026-02-18T22:05:13+08:00" level=info msg="The RMQClient stopping do 
rebalance" clientID=192.168.176.1@40740
   time="2026-02-18T22:05:13+08:00" level=info msg="The RMQClient stopping 
clean off line broker and heart beat" clientID=192.168.176.1@40740
   time="2026-02-18T22:05:13+08:00" level=info msg="will remove client from 
clientMap" clientID=192.168.176.1@40740
   panic: runtime error: invalid memory address or nil pointer dereference
   [signal 0xc0000005 code=0x0 addr=0x8 pc=0xb52546]
   
   goroutine 1 [running]:
   github.com/apache/rocketmq-clients/golang/v5.(*defaultClient).Sign.func1(...)
        
C:/Users/30979/go/pkg/mod/github.com/apache/rocketmq-clients/golang/[email protected]/client.go:667
   
github.com/apache/rocketmq-clients/golang/v5.(*defaultClient).Sign(0x2c261c8, 
{0xe05028, 0x137ea00})
        
C:/Users/30979/go/pkg/mod/github.com/apache/rocketmq-clients/golang/[email protected]/client.go:670
 +0x106
   
github.com/apache/rocketmq-clients/golang/v5.(*defaultClient).queryRoute(0x2c261c8,
 {0xe05028, 0x137ea00}, {0xce5576, 0xa}, 0xb2d05e00)
        
C:/Users/30979/go/pkg/mod/github.com/apache/rocketmq-clients/golang/[email protected]/client.go:370
 +0x33
   
github.com/apache/rocketmq-clients/golang/v5.(*defaultClient).getMessageQueues(0x2c261c8,
 {0xe05028, 0x137ea00}, {0xce5576, 0xa})
        
C:/Users/30979/go/pkg/mod/github.com/apache/rocketmq-clients/golang/[email protected]/client.go:347
 +0x10f
   
github.com/apache/rocketmq-clients/golang/v5.(*defaultClient).startUp(0x2c261c8)
        
C:/Users/30979/go/pkg/mod/github.com/apache/rocketmq-clients/golang/[email protected]/client.go:538
 +0x12e
   
github.com/apache/rocketmq-clients/golang/v5.(*defaultProducer).Start(0x2c18960)
        
C:/Users/30979/go/pkg/mod/github.com/apache/rocketmq-clients/golang/[email protected]/producer.go:55
 +0x26
   main.v5()
        I:/qmtyRpc/test/test.go:79 +0x32f
   main.main()
        I:/qmtyRpc/test/test.go:53 +0x539
   
   
   ### Additional Context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to