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

how i can effectively block "publish" from sending messages or check state of connection in more speed manner? #29

Open
poulch74 opened this issue Dec 28, 2020 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@poulch74
Copy link

The problem is - low heap. For example after onConnect I start publish messages each 1 sec to
remoute mqtt server. All ok until WAN interface of my router goes down. if keepAlive
is about 15 then "publish" eat all heap but I not receive any onError or onDisconnect
and MCU fail and reboot. I can limit keepAlive to 3, so until heap goes low
onDisconnect fired and i can recovery. but I think it not right way... (keepAlive can be under user control)
I can check heap and block "publish"... but... so which right way?

@philbowles
Copy link
Owner

Can you send me some diagnostic output from the serial monitor and/or wireshark traces please? Its very difficult to try to understand this without seeing some data. Also seeing your own code and how you are using Pangolin might be helpful too

@philbowles philbowles self-assigned this Jan 2, 2021
@philbowles philbowles added the question Further information is requested label Jan 2, 2021
@poulch74
Copy link
Author

poulch74 commented Jan 5, 2021

I use pangolin in simple manner like
`
setup() { .... mqtt.connect(); }

onConnect() { mqtt.subscribe(); can_publish = 1; }

onDisconnect() { can_publish = 0;}

onError() {can_publish = 0;}

void loop() { if(can_publish) mqtt.publish(); delay(1000);}
`
but if router WAN interface goes done no packets transmitted to remoute mqtt server, but heap eated by mqtt queue and tcp buffers -> low heap and reset before any callback (onDisconnect or onError) fired... maybe some timeout mangment for tcp ack must be added to api (asynctcp default about 5000ms?)?

@philbowles
Copy link
Owner

It looks like there may be an error in Pango's keepalive / server notification system. I will look into it using the very rough sketch you outlined.

On a separate note, is there a problem with you sending me the actual sketch? The more work you make me do to try to fix the problem, the less likely I am to get round to it - please show me the actual code you are running: a) there may be some other problem with it b) there is no point "debugging" NOT (the code you are running) to try to find a problem in the code you are running.

Also how do you detect / manage WAN reconnection? If the WAN goes down, then yes Pango should spot it and give you a timeout error. But even assuming it DID do that correctly. your example will just sit in the main loop forever , doing nothing until you reboot the MCU...anyway, post me the code and I will look into it.

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

No branches or pull requests

2 participants