-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
client goes offline on publish on mac #252
Comments
Had same problem with the 1.x and mosquitto 1.3.5
|
Just tried that, still the same. |
This is what I tried since opening this issue: After adding some console log I can't get any further than the sendPacket function. The buffer generated from
so it ends in the client.stream.write function for the pubcomp for me. I tried to connect via TLS, but it's just the same. Here's the full verbose output:
I'm definitely not that familiar with the MQTT Protocol and the way MQTT.js works, but shouldn't there be a PUBREL instead of a PUBCOMP? And why is there no PUBREL on the on-connect publish with QoS 2, but a PUBREC? PUBCOMP and PUBREC are packages that should come from the server, like described here: http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#qos-flows Tomorrow I'll do some more debugging, having a closer look on the actual message flow. BTW: Could you document the possible options a little bit better? When trying to connect via TLS (only encryption, no authentication) you have to set protocol to mqtts, but I had to look into the code to find this option. Also, the client says |
The diagram you linked explain the the exchange poorly, replace 'client' with 'sender' and 'server' with 'receiver'. As the two roles can be exchanged if a client does a qos2 subscription. I think you should try to debug it Regarding options, send a PR against the README, I'll get that merged :D. |
I'm at a miss, I don't know how to debug any further. I have created a wireshark capture you can find here: https://www.dropbox.com/s/07wml3sfnj5knh9/delayed-publish.pcapng?dl=0 The output for this is as follows:
I have no idea what should happen and what not. If you could tell me what to do I'll try. QoS 0 clients get the message twice, once before and once after the disconnect. QoS 2 clients obviously only once because of the missing PUBREL. I also have this problem on another Windows machine, so it isn't just Mac related. EDIT: So I made a mistake, now ALL devices where I installed node and used mqtt.js, the delayed publish is now occuring. I don't have any "clean" systems now. what should I try? |
Hi, I took a look at it, Could @meilon document exactly the steps to recreate? I tried with the above sample and it seemed to work for me on x86. Here are my steps: (note mqtt.252b.js is the exact same code as originally posted) 1 node mqtt.252b.js < next output showed up after step 2> 2 ./mqtt.js publish -v --host test.mosquitto.org -t /poke -m "hi" With those above steps i didn't see the offline part. What steps do you do in order to get the offline? |
Hi I think i would like to work on this. Do the issues get assigned to prevent someone else from duplicating the effort at the same time? |
I just tried it again in a blank directory, still the same. But what I tried additionally after seeing you did the poke with QoS 0, I did the same on my system: The message gets pubbed right away on a QoS 0 and 1 message! So it seems it is related how the message got sent in the first place! A received QoS 2 message in a QoS 2 subscription causes a disconnect on a following QoS 2 publish. |
@mdickens it is all yours, thank so much in helping out! |
I just recreated it on a local setup with mosquitto. It seems that the client does not receive the PINGRESP sent by the server in this particular usage pattern. client tracegenerate:pingreq mosquitto trace1424210278: Received PINGREQ from delayed-demo |
I think I found the bug
In fact, here https://github.com/mqttjs/MQTT.js/blob/master/lib/client.js#L219 it is called with two arguments. You should be able to write a unit test by sending any packet after a PUBREL, it will not get processed. @mdickens It's still on you to assemble a PR :P. Thank so much for debugging it!! |
ok i will work on it , thank you |
My apologies, i got distracted with some other work, including having to move all of my furniture, but I still plan to do this if the delay is not too much trouble for everyone. Thanks! |
No worries, I have been busy myself :(. |
Hi, I got the mocha test running, but could use some advice about where you think the test would be best placed. Do you think it should go in the abstract_client.js file or where is the best place? Thanks, Marc |
is there another test that you think is close to what we need that would be a good starting point for me to check that pattern |
i sent a pr with what i have done, hope it helps! |
@mcollina Ha ha, I just noticed you tried to tag me. It's ranger not roger :p |
ahahah yes :D. |
Hi,
I'm developing an app on my MacBook Pro and I have a problem with MQTT.js 1.0.10 on it. The client should receive a message on one QoS 2 topic, do some stuff with it and publish it on another QoS 2 topic.
After the message reaches the client at first nothing happens on the console. Then, after the keepalive timeout occurs, the client reconnects and publishes the message. The general error event doesn't get called and the err object in the publish callback doesn't contain anything.
This happens with mosquitto 1.3.5, iot.eclipse.org and test.mosquitto.org without TLS on my MacBook Pro with current OSX 10.10.2 and node 0.12.0. Because the same script works on a Raspberry Pi with note 0.10.26 I'm guessing it's an issue with my Mac or it's generally Mac reladed. Node is installed via brew
Here the code I'm testing with:
And here's the console output:
The text was updated successfully, but these errors were encountered: