This is an automated email from the ASF dual-hosted git repository.
RongtongJin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new e9521d5d fix(golang): add missing return in SendAsync when producer is
off (#1264)
e9521d5d is described below
commit e9521d5da81af9d11ef69fb3cda1393fd80c07f8
Author: guyinyou <[email protected]>
AuthorDate: Thu Jun 11 15:00:56 2026 +0800
fix(golang): add missing return in SendAsync when producer is off (#1264)
When the producer is not running, SendAsync invoked the callback with
an error but did not return, causing the subsequent goroutine to also
execute. This resulted in the callback being called twice and a
goroutine leak.
Co-authored-by: guyinyou <[email protected]>
---
golang/producer.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/golang/producer.go b/golang/producer.go
index ab3232c2..e9d733f8 100644
--- a/golang/producer.go
+++ b/golang/producer.go
@@ -345,6 +345,7 @@ func (p *defaultProducer) Send(ctx context.Context, msg
*Message) ([]*SendReceip
func (p *defaultProducer) SendAsync(ctx context.Context, msg *Message, f
func(context.Context, []*SendReceipt, error)) {
if !p.isOn() {
f(ctx, nil, fmt.Errorf("producer is not running"))
+ return
}
go func() {
msgs := []*UnifiedMessage{{