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

Tracer start failed when starting multiple MqProducer in one process #1188

Closed
kangjiabang opened this issue Apr 29, 2019 · 7 comments
Closed

Comments

@kangjiabang
Copy link

i want to use trace feature in 4.4.0.
when i init two defaultMQProducer , use new DefaultMQProducer(producerId,true);
then i start to send message to test trace, trace not work well。

i find when producer start with trace on,it will produce new AsyncTraceDispatcher,in AsyncTraceDispatcher, it will invoke getAndCreateTraceProducer method.

private DefaultMQProducer getAndCreateTraceProducer(RPCHook rpcHook) { DefaultMQProducer traceProducerInstance = this.traceProducer; if (traceProducerInstance == null) { traceProducerInstance = new DefaultMQProducer(rpcHook); traceProducerInstance.setProducerGroup(TraceConstants.GROUP_NAME); traceProducerInstance.setSendMsgTimeout(5000); traceProducerInstance.setVipChannelEnabled(false); // The max size of message is 128K traceProducerInstance.setMaxMessageSize(maxMsgSize - 10 * 1000); } return traceProducerInstance; }
but the ProducerGroup is same for all trace Producer . when i start two MQProducer ,i will report error like following .
throw new MQClientException("The producer group[" + this.defaultMQProducer.getProducerGroup() + "] has been created before, specify another name please." + FAQUrl.suggestTodo(FAQUrl.GROUP_NAME_DUPLICATE_URL), null);

@ChaosYjh
Copy link
Contributor

I think it is a bug too, but it seems that no one cares about this problem.@duhenglucky ,can you look at this question? Thanks~~

@duhenglucky
Copy link
Contributor

duhenglucky commented Jun 19, 2019

@ChaosYjh try to setInstanceName when creating producer,and recommend to create one producer to send different topic messages, and it would be nice if you can proposal a PR to polish this issue.

@zongtanghu
Copy link
Contributor

@ChaosYjh @kangjiabang We will check this issue in our local enviroment.

@ChaosYjh
Copy link
Contributor

@ChaosYjh try to setInstanceName when creating producer,and recommend to create one producer to send different topic messages, and it would be nice if you can proposal a PR to polish this issue.
Set instanceName can resolve this problem,but it will create double tcp connection at least.
In our users, there are many application system use producer and consumer both ,and there are three or four consumerGroup,may be more.So I hope they use one clientInstance in common to create tcp connection as little as possible and save resource.
In AsyncTraceDispatcher,traceProducer specified producerGroup by TraceConstants.GROUP_NAME always, so I think can we specify a different producerGroup for each traceProducer and use one instanceName in common?

image

@ahuazhu
Copy link
Contributor

ahuazhu commented Jun 19, 2019

@ChaosYjh Thanks, Set different ProducerGroups for consumer/producer will resolve the problem. I will create a PR to fix the bug.
#1275

@lnfdxwl
Copy link

lnfdxwl commented Nov 18, 2019

@ahuazhu hi,when make release ,thanks

@duhenglucky
Copy link
Contributor

fixed in the 4.6.1

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

No branches or pull requests

6 participants