-
Notifications
You must be signed in to change notification settings - Fork 169
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
Publish failed! #2
Comments
I'm experiencing the same problem: every n-th publish request fails. Can you pls track and resolve this? Thx. |
Any progress on this topic? |
Look at the error code and compare it to |
Does anyone know how to correctly include the certificates in the .ino file? I have tried adding them one by one after this line "char rcvdPayload[512];" but I keep getting this error > "E (2195740) aws_iot: failed! mbedtls_x509_crt_parse returned -0x2180 while parsing root cert Any help will be appreciated. |
Check this tutorial. Include the certificates in this file. Do not forget to add '\n' at the end of each line except for the last line. |
So I can't include different certificates per project? I have to put them in the library itself? |
@paulmand3I look at #9
and add a file in Arduino sketch say AWS_certs.h
and your certs in that. Atleast that worked for me. |
Hi, Also get this every 6th publish is failing.
according to aws_iot_error.h it is MQTT_CLIENT_NOT_IDLE_ERROR = -30 |
We've been fighting this for days. The "Publish failed" message is in the example code itself. I think we have it fixed. It has to do with a Yield function in AWS_IOT.cpp We have reduced the yield time to 5ms and the TaksDelay to 550; Try that. void aws_iot_task(void *param) { IoT_Error_t rc = SUCCESS;
} |
And to elaborate on why you should change the aws_iot_task to use 5ms timeout and 550 task delay. Previously the settings were 200ms timeout and 1 second delay. Let's put that in perspective. That means that 200/1200 of the time (1/6th of the time) the library was waiting for MQTT traffic in the call to aws_iot_mqtt_yield. Because it is running in a separate thread it could do this behind your back. So, when you try to publish you have a 1 out of 6 chance of the library actually being in the wait state inside of aws_iot_mqtt_yield. Changing this timeout to 5ms but doing it about twice as often yields a 5/555 chance (1/111) which is MUCH better odds. You don't need to spend forever in each call to aws_iot_mqtt_yield. The underlying networking stack will queue frames for you and unless you've got a lot of subscribed messages you aren't going to stack them up. If you do have a lot of subscribed messages coming in then just lower the wait time and the delay time. There's no reason to wait more than 1-2 milliseconds if no message is pending to be received. So, 1ms wait and like 100ms delay would be fine if you don't think you'd get more than 10 MQTT messages per second. At any rate, you can calculate your chances of this library killing your publishes as (yieldtime)/(yieldtime + delaytime). A potentially better solution is to move the call to aws_iot_mqtt_yield to your sketch's loop function. This could be done by exposing a method from the AWS_IOT class that you call in loop. I understand why the author didn't do this. It would make it more complicated to use and people would have to actually add the call to loop. But, it then yields a basically 0% chance of a publish failure due to client state not idle. And that's all I have to say about that. ;) |
I changed in AWS_IOT.cpp, I don't receive Public fail anymore |
Thanks for this fix. Saved a bunch of code trying to deal with the occasional failure. |
Same issue, worked like a charm ! Thanks ! |
hornbill.publish(TOPIC_NAME,payload) fails to return zero sometimes. In my case it fails once every 3 times.
The text was updated successfully, but these errors were encountered: