hemikak / mqtt-jmeter

This is the plugin for Jmeter to Test MQTT protocol
Apache License 2.0
22 stars 7 forks source link

MQTT Protocol deconnexion error #9

Open laurent-bury opened 7 years ago

laurent-bury commented 7 years ago

Hello,

at the end of each Mqtt test (with "Publisher" component), I have an error 32101 (from the MQTT protocol point of vue, it means 'Client already disconnected',), along with a Java stack like this one:

2017/01/31 16:18:01 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of en d of test 2017/01/31 16:18:01 ERROR - jmeter.protocol.mqtt.sampler.PublisherSampler: Client is disconnec ted java.io.IOException: Client is disconnected at org.apache.jmeter.protocol.mqtt.paho.clients.BlockingClient.close(BlockingClient.java:176) at org.apache.jmeter.protocol.mqtt.client.ClientPool.clearClient(ClientPool.java:42) at org.apache.jmeter.protocol.mqtt.sampler.PublisherSampler.testEnded(PublisherSampler.java:172) at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfEnd(StandardJMeterEngine.java:216) at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:437) at java.lang.Thread.run(Thread.java:745) Caused by: Client is disconnected (32101) at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(Excepti onHelper.java:31) at org.eclipse.paho.client.mqttv3.internal.ClientComms.disconnect(ClientComms.java:422) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:537) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:506) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:513) at org.eclipse.paho.client.mqttv3.MqttClient.disconnect(MqttClient.java:254) at org.apache.jmeter.protocol.mqtt.paho.clients.BlockingClient.close(BlockingClient.ja va:174) ... 5 more__

It also happens when using several threads in jMeter, when each thread is shutting down.

From the server point of vue, we have the following kinf of logs: **2017-02-07 07:22:02.465 INFO 21536 --- [nioEventLoopGroup-3-1] .o.i.c.m.n.UnauthenticatedChannelHandler S[d330e4f1-0bed-423a-9e5f-b8c428fa5506]:RA[/10.0.1.92:36572]:MC[urn:lo:nsid:BenchMQTT:0002]:MU[json+device] : auth failed => CONNACK 'refused' and close : null

So I Wonder if I have something to do in jMeter to close the MQTT session prior to end the test and avoiding this error, or if the problem is due to a bad diconnexion management in the plugin ?

Thank you for your help.

RamatiAriel commented 6 years ago

Hi i have the same issue, each time i'm using the mqtt publisher i'm getting this exception at the end of the test, but i think i have a more severe issue caused by that- when i'm running my test using jenkins the job does not finish because there are living threads. do you know how to handle this issue?

laurent-bury commented 6 years ago

Hello,

unfortunately I no longer work on that subject for a while. I remember though that the threads deconnexion issue did not prevent us to simulate workload, and the jMeter script ended correctly anyway, but with errors in the logs...

hemikak commented 6 years ago

@RamatiAriel , May I now how to reproduce the issue ? I tested the publisher using visualvm and could not find any extra threads running after the tests. I published 100 messages. See attachments.

Before running the tests. before-running-tests

After running the tests after-test

Any other ways to reproduce the mentioned issue ?

Regards,

hemikak commented 6 years ago

Hi @laurent-bury , May I know the steps to reproduce this error ?

2017/01/31 16:18:01 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of en d of test 2017/01/31 16:18:01 ERROR - jmeter.protocol.mqtt.sampler.PublisherSampler: Client is disconnec ted java.io.IOException: Client is disconnected at org.apache.jmeter.protocol.mqtt.paho.clients.BlockingClient.close(BlockingClient.java:176) at org.apache.jmeter.protocol.mqtt.client.ClientPool.clearClient(ClientPool.java:42) at org.apache.jmeter.protocol.mqtt.sampler.PublisherSampler.testEnded(PublisherSampler.java:172) at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfEnd(StandardJMeterEngine.java:216) at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:437) at java.lang.Thread.run(Thread.java:745) Caused by: Client is disconnected (32101) at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(Excepti onHelper.java:31) at org.eclipse.paho.client.mqttv3.internal.ClientComms.disconnect(ClientComms.java:422) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:537) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:506) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:513) at org.eclipse.paho.client.mqttv3.MqttClient.disconnect(MqttClient.java:254) at org.apache.jmeter.protocol.mqtt.paho.clients.BlockingClient.close(BlockingClient.ja va:174) ... 5 more__

RamatiAriel commented 6 years ago

Hi, in order to reproduce this error i've used AsyncClient, used multiple threads (this reproduced when i've used at least 2 threads) and for qos- "at least once". I had 3 MQTT publishers in each thread group with the same client ID, topic, UserName & password (basically it spouse to be the same exact publisher to multiple servers). None of the messages had failed, but only at the end of the test i got this error and my jenkins job did not finish. once I changed to blocking client the error stopped and everything is working. the exception causing this error is: org.eclipse.paho.client.mqttv3.MqttPersistenceException: Persistence already in use i no longer have the full stack trace of this, if there is anything else you need please let me know.

Ariel

laurent-bury commented 6 years ago

Hello Hemikak,

I apologize, this is an old issue for me now, and I am not able to reproduce it as the environment non longer exists...

hemikak commented 6 years ago

@laurent-bury ,

No problem.

@RamatiAriel ,

Thanks for the steps. I will try to reproduce it on my end.

Thanks all!