Closed bbigras closed 5 years ago
Thanks for the report. There is a major refactor happening now. I'll verify this as soon as I'm done with it
FWIW I'm using 60s with VerneMQ as a broker, and I have frequent disconnections because rumqtt "forgets" to ping sometimes (I often see 120s between pings).
@bestouff @bbigras Can you verify if develop
branch solved this issue?
I still have the problem. It still doesn't happen every time, only sometime.
branch=develop 8e78893ecb6711d66ae20c58f207357c3d08f43f rustc 1.36.0-nightly (7c71bc320 2019-04-30)
[2019-06-28T13:31:39Z DEBUG tokio_reactor] adding I/O source: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Write for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z INFO rumqtt::client::connection] Mqtt connect response = Some(Connack(Connack { session_present: false, code: Accepted }))
[2019-06-28T13:31:39Z INFO rumqtt::client::connection] Mqtt connection successful!!
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG rumqtt::client::connection] Incoming packet = "Puback(PacketIdentifier(1))"
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:39Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:47Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:49Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:49Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:49Z DEBUG rumqtt::client::mqttstate] Ping = None. keep alive = 10,
last incoming packet before 9 secs,
last outgoing packet before 9 secs
[2019-06-28T13:31:49Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:49Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:49Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:31:54Z DEBUG rumqtt::client::mqttstate] Ping = Ping. keep alive = 10,
last incoming packet before 15 secs,
last outgoing packet before 5 secs
[2019-06-28T13:31:54Z DEBUG tokio_reactor] dropping I/O source: 0
[2019-06-28T13:31:54Z DEBUG rumqtt::client::connection] Eventloop stopped with error. NetworkStreamClosed
notification: Disconnection
[2019-06-28T13:32:04Z DEBUG tokio_reactor] adding I/O source: 0
[2019-06-28T13:32:04Z DEBUG tokio_reactor::registration] scheduling Write for: 0
[2019-06-28T13:32:04Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:32:04Z INFO rumqtt::client::connection] Mqtt connect response = Some(Connack(Connack { session_present: false, code: Accepted }))
[2019-06-28T13:32:04Z INFO rumqtt::client::connection] Mqtt connection successful!!
notification: Reconnection
[2019-06-28T13:32:04Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:32:04Z DEBUG tokio_reactor::registration] scheduling Read for: 0
[2019-06-28T13:32:04Z DEBUG tokio_reactor::registration] scheduling Read for: 0
$ docker run -it --rm -p 1883:1883 -p 9001:9001 eclipse-mosquitto
1561728680: mosquitto version 1.6.3 starting
1561728680: Config loaded from /mosquitto/config/mosquitto.conf.
1561728680: Opening ipv4 listen socket on port 1883.
1561728680: Opening ipv6 listen socket on port 1883.
1561728699: New connection from 172.17.0.1 on port 1883.
1561728699: New client connected from 172.17.0.1 as test-id-1 (p2, c1, k10).
1561728714: Client test-id-1 has exceeded timeout, disconnecting.
1561728724: New connection from 172.17.0.1 on port 1883.
1561728724: New client connected from 172.17.0.1 as test-id-1 (p2, c1, k10).
1561728726: Socket error on client test-id-1, disconnecting.
^C1561728727: mosquitto version 1.6.3 terminating
Thanks for the report. This helped uncover a bug. I couldn't reproduce this with your example but some late publishes caused similar issue. I think the root problem is fixed and unit tests are in place. Want to give it a try? :)
I don't seem able to reproduce the problem with branch=develop 5336f2d1126e10c807fe22263589f6e79ae95e82 :+1:
Cool. I'll go ahead and close this. Feel free to reopen if this reoccurs
Is there an official release where this bug is fixed ?
Ping?
Ah sorry. No release yet. I'll push to crates on monday
Great thanks
Maybe related to https://github.com/AtherEnergy/rumqtt/issues/76.
This code often disconnects after 15 secs but not every time.
rumqtt 3b5571a40275be65188a678c39d70b75e67a77d7 rustc 1.36.0-nightly (7c71bc320 2019-04-30)