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

about auto-connection issues #48

Open
luchec opened this issue Aug 27, 2015 · 4 comments
Open

about auto-connection issues #48

luchec opened this issue Aug 27, 2015 · 4 comments

Comments

@luchec
Copy link

luchec commented Aug 27, 2015

i use "mqtt.setReconnectAttemptsMax(-1)" to set the program auto connect in disconnection,but when i turn off wifi,maybe have passed 30s ,fusesource mqtt-client callback disconnect notification for。 and then turn on again, maybe few seconds,mqtt-client auto connecting ,but appear twice connect,it is cause a loop that connected and disconnect。could somebody help me? thanks

@lopatoid
Copy link

I have the same problem, but I find it very hard to reproduce. Sometimes it's OK, but sometimes it just goes into loop of connects and disconnects, then program crashes with NPE or OOM.
BTW, I am using the Callback/Continuation Passing based API on Android. And you, @luchec ?

@lopatoid
Copy link

OK, definitely a bug. I've found a way to get a good percent of reproducibility.

  1. Run your program. Then on host with MQTT server (I use mosquitto) execute:
sudo iptables -A INPUT -p tcp --dport 1883 -j DROP

wait up to 30 seconds... than:

sudo iptables -D INPUT -p tcp -m tcp --dport 1883 -j DROP

And voila!

If using blocking connection (for simplicity I even started sample program on localhost):

Exception in thread "hawtdispatch-DEFAULT-2" java.lang.NullPointerException
    at org.fusesource.mqtt.client.CallbackConnection$7.run(CallbackConnection.java:414)
    at org.fusesource.hawtdispatch.transport.HeartBeatMonitor$3.run(HeartBeatMonitor.java:83)
    at org.fusesource.hawtdispatch.transport.HeartBeatMonitor$1.run(HeartBeatMonitor.java:62)
    at org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100)
    at org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77)

If using Callback/Continuation Passing based API, I see this loop of connects and disconnects and they occurs on different hawtdispatch threads. Like this:

hawtdispatch-DEFAULT-3 : connected
hawtdispatch-DEFAULT-1: connected
hawtdispatch-DEFAULT-1: disconnected
hawtdispatch-DEFAULT-4: connected
hawtdispatch-DEFAULT-2: connected
hawtdispatch-DEFAULT-2: disconnected
... etc etc

@chirino , is there any workaround?

@Monachus
Copy link

@looluo you know if they are going to merge this back at fuse-source?

@MarcoPOLOFXH
Copy link

@chirino Still tracking this issue, would like to see @looluo's merged at fuse-source or for it to be otherwise addressed.

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

No branches or pull requests

4 participants