Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

生产者消息轨迹丢失 #8321

Open
3 tasks done
pig6 opened this issue Jun 21, 2024 · 1 comment
Open
3 tasks done

生产者消息轨迹丢失 #8321

pig6 opened this issue Jun 21, 2024 · 1 comment

Comments

@pig6
Copy link

pig6 commented Jun 21, 2024

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

linux

RocketMQ version

5.1.4

JDK Version

1.8

Describe the Bug

使用rocketmq 5.1.4。

相同的问题链接:#2988
解决上面问题的fix:#2989

虽然上面给出了解决,但方案并不完善。

DefaultMQProducer.shutdown()中先将defaultMQProducermpl.shutdown(),然后再调用AsyncTraceDispatcher.shutdown(),这会导致AsyncTraceDispatcher.flush()方法无法发送轨迹消息(因为发消息依赖defaultMQProducermpl),从而导致生产者轨迹丢失。

1651718961881_ pic

另外AsyncTraceDispatcher.flush()也存在问题:当AsyncTraceDispatcher.run()执行到traceContextQueue.poll与taskQueueByTopic.put之间时(正在转换的任务),AsyncTraceDispatcher.flush()判断traceContextQueue为空就直接break了,导致正在转换的任务丢失,从而导致轨迹消息没发出去。
1651718961882_ pic
1651718961883_ pic

Steps to Reproduce

发完消息就关闭producer(消息管理端的发消息功能),会出现这个问题。

What Did You Expect to See?

生产者轨迹不丢失

What Did You See Instead?

业务中延迟500ms调用DefaultMQProducer.shutdown()

Additional Context

No response

@drpmma
Copy link
Contributor

drpmma commented Jun 24, 2024

DefaultMQProducer.shutdown()中先将defaultMQProducermpl.shutdown(),然后再调用AsyncTraceDispatcher.shutdown(),这会导致AsyncTraceDispatcher.flush()方法无法发送轨迹消息(因为发消息依赖defaultMQProducermpl),从而导致生产者轨迹丢失。

AsyncTraceDispatcher内部有自己的producer实例,为什么会依赖defaultMQProducermpl呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants