apache / rocketmq-client-go

Apache RocketMQ go client
https://rocketmq.apache.org/
Apache License 2.0
1.28k stars 409 forks source link

response future done channel close late causes normal requests to report a timeout error #1114

Open twz915 opened 8 months ago

twz915 commented 8 months ago

The issue tracker is ONLY used for the go client (feature request of RocketMQ need to follow RIP process). Keep in mind, please check whether there is an existing same report before your raise a new one.

Alternately (especially if your communication is not a bug report), you can send mail to our mailing lists. We welcome any friendly suggestions, bug fixes, collaboration, and other improvements.

Please ensure that your bug report is clear and that it is complete. Otherwise, we may be unable to understand it or to reproduce it, either of which would prevent us from fixing the bug. We strongly recommend the report(bug report or feature request) could include some hints as to the following:

BUG REPORT

  1. Please describe the issue you observed: When ctx time out, r.ctx.Done() returns, causing a normal response to return an error as well

https://github.com/apache/rocketmq-client-go/blob/7ae83c49351a96d78ebccec5dd545f0c05e3d514/internal/remote/remote_client.go#L233-L235

https://github.com/apache/rocketmq-client-go/blob/7ae83c49351a96d78ebccec5dd545f0c05e3d514/internal/remote/future.go#L60-L66

A simple way to reproduce this is to add time.Sleep(time.Second*3) before if r.callback != nil, then callback return get resp.Err, which is not nil

https://github.com/apache/rocketmq-client-go/blob/7ae83c49351a96d78ebccec5dd545f0c05e3d514/internal/remote/future.go#L47C5-L53

So response future should close channel before callback