-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
MQTT fails on long messages #2
Comments
Hmmm, after some more testing, it seems to be that is something weird going on with the length of the string. If publish I'll see if I can find why. |
I can confirm that it works both ways (receiving and publishing), longer messages are not processed... |
Uuuuuugh, got it! Took me a while! :D Topic needs to be a Awesome, it works! :D woohoo! |
Hmmm, there still is an issue with either long messages, or a long |
Ha! Got it :) It was a bit of a search, but the Paho client is by default limited to max packages of X size. So ofcourse, this would result message failures when the topic + message gets a bit longer. Changing: Fixed the issue, the 255 is the max length of the MQTT packages (the longer, the memory it will use as well, ofcourse). This is also valid for the incoming package length (so for receiving messages from the outside). Pretty important :) |
@svdgraaf I've notice this testing today. I've implemented the auto-reconnection feature and fix the need of that wait for connection workaround. Of course, it would be very nice to stress test these features ;-) next target.... remove the need for bytebuffer |
Awesome, I'll run some more testing tomorrow :) Cheers! On 28 mrt. 2016 20:58 +0200, odelotnotifications@github.com, wrote:
|
hi @svdgraaf, let me ask you something? are you using the stage or stable version of arduino esp8266 code? 2.1.0 or 2.1.0-rc2? I am investigating the memory leak after many reconnections. Tried the stable version and nothing worked, neither the first connection. O.o |
I'm running a git checkout, it's revision |
I've got the latest version from git and I'm still having problems this simple code shows that heapspace get smaller after each reconnection
this code is using esp8266 core :-( my board is a generic one but It seems to be a software issue. |
I tested that code and I had the same outcome, the heap keeps shrinking after every loop. I did a quick search and it looks like that you are not the first one to notice this, here is a blog post about that (see "The Unexpected Discovery" paragraph): http://internetofhomethings.com/homethings/?p=1232 And a couple issues I found showing more details and possible solutions: esp8266/Arduino#230, esp8266/Arduino#1070 Edit: I did some more testing, here is the output of 200 iterations with a 3 minutes delay in the middle. The heap does recover and this confirms that the issue is caused only because "closed connections go into TIME_WAIT state where they must be kept by the TCP stack for 2xMSL interval".
|
thank you @daniele-salvagni, this mod fixed the issue esp8266/Arduino#230 (comment) strange that it is not in the master branch yet. |
I can concur that I'm having the same issue, I just did a recompile with the btw: I had issues with connecting to the mqtt from the latest checkout on the |
I'm still investigating before close issue #5
|
@svdgraaf it is a great way to keep track of memory Here is my findings: Ive cleaned up the code a little bit (commited it already*) and changed the example (see below). Now it seems that memory usage is almost ok, althought we need to test and investigate a little more. Between the first and second connection, we lose 316 bytes (maybe the first subscribe? need to investigate it). After this, the memory seems to float but coming back eventually to the same level that was recorded in the second connection. When we got an error trying to connect to mqtt server, we lose 168 bytes as well. program execution... free heap space between (parentheses)
and here is my new example code (still didnt commit it*, I need to test more):
* I probably should make a branch to avoid been commiting all the time. Sorry, I'am used to CVS, SVN, but git is still new to me. I will try to learn all git stuff in the near future ;-)
|
after 28 hours, the esp8266 crashed again... but it seems not be caused by memory leak I will try to investigate this exception (29) but the memory issue seems to be under control have any of you guys already had problems with exception 29?
*note that memory usage (27240) from connection 374 is the same from the connection from last post |
Nice! I haven't been able to look at your new code yet, but sounds very promising! :) On 14 apr. 2016 14:16 +0200, odelotnotifications@github.com, wrote:
|
After some looking around, the 29 exception does point to an invalid reference somewhere (trying to overwrite a value in virtual memory which is prohibited). Can you perhaps create push a branch with your current code? I can hook up a debugger, and see where the issue is. |
I figured my esp must have crashed by now, but hadn't checked the actual output. I just did, and it's still running (~29 hours now), the heap size is stable for the last few hours around 10k. It's posting to a mqtt channel every 10 seconds. I'm running |
Still going strong after 49 hours... Heap size still the same |
@svdgraaf the code at github is my most up to date code... I just didn't upload the example code yet, but I've posted it above. it seems that the memory issue was fixed. |
I found the sample code in the above comment to be tremendously helpful. The Sample I'd been working off previously was failing frequently on connection. This sample worked great :) I am connected and successfully receiving messages. |
It seems I spoke too soon - I'm still running into issues getting the websocket connection to work:
It just keeps on rolling like that. Any suggestions on what to do to make the websocket connect more reliable? I got it working once, but now I have no idea what make that work. |
Hi, please start sntp first ! Appreciate your help on this. |
Regarding the SNTP issue: Add the following line to the Setup section, configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov"); |
I think I've found an issue. When I publish a message with a quote it in
"
, the message is never received on the iot end. When I publish a message without json, it does work:The topic I subscribed to is
$aws/things/xyz/shadow/update
.With regular text:
With quotes:
No response ;)
The text was updated successfully, but these errors were encountered: