emqx / mqtt-jmeter

MQTT JMeter Plugin
https://www.emqx.com/en
Apache License 2.0
447 stars 193 forks source link

using "share conn in thread" - sample doesn't stop in case of a lost connection #32

Open Hmm90 opened 6 years ago

Hmm90 commented 6 years ago

Using two mqtt Pub sampler in one thread (sampler A and sampler B) with "share conn in thread" option. Sampler A build the connection and publish a message.

Sampler B is publishing the message with a delay after sampler A.

During that delay the connection get lost and sampler B is running in a exception:

2018-04-05 15:10:25,124 INFO n.x.s.PubSampler: Use the shared connection: org.fusesource.mqtt.client.CallbackConnection@46877199 2018-04-05 15:10:25,124 ERROR n.x.s.PubCallback: Peer disconnected java.io.EOFException: Peer disconnected at org.fusesource.hawtdispatch.transport.AbstractProtocolCodec.read(AbstractProtocolCodec.java:331) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.transport.TcpTransport.drainInbound(TcpTransport.java:710) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.transport.SslTransport.drainInbound(SslTransport.java:276) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.transport.TcpTransport$6.run(TcpTransport.java:592) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.internal.NioDispatchSource$3.run(NioDispatchSource.java:209) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100) ~[mqtt-xmeter-jar-with-dependencies.jar:?] at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77) ~[mqtt-xmeter-jar-with-dependencies.jar:?]

But testplan didn't stop, also with a defined timeout of 5 seconds.

rende2005 commented 6 years ago

@Hmm90 I tried to reproduce the issue based on your description, but didn't see the 2nd pub sampler failure. It worked as expected in my case (against an EMQ 2.0 server).

Would you share your test script, and what is the mqtt backend in your environment?

rende2005 commented 6 years ago

image image

rende2005 commented 6 years ago

image

Hmm90 commented 6 years ago

image image image image

05 MQTT Pub and 07 MQTT Pub shares one connection Only one connection is allowed. If "second connection - shared connection of 05 MQTT Pub and 07 MQTT Pub get lost" is executed, the shared connection is reset by broken and can't use connection but also don`t stop. RabbitMQ Broker is used