Memory leak... ESP8266 + 0-length response #367
Replies: 16 comments
-
Posted at 2015-04-20 by DrAzzy My code:
Trace attached Thanks to anyone who can see what's getting duplicated in memory and eating up memory....Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by @gfwilliams Any chance you could do a trace, process a few commands, and then do another one and attach both? It'd make it easier to diff them... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by DrAzzy Traces before and after turning my desk light off and on with my voice. (Switch, option 4 on the submenu)Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by @gfwilliams Just looked and I'm pretty sure that in this case it's because there are two open HTTP connections. It's odd because the This is done with the ESP8266? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by DrAzzy Yup, ESP8266 on Pico. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-21 by DrAzzy Any ideas on what's going on here? I'd really like to get this working; I'm dead in the water currently on this project right now because of this memory leak, which I really don't know how to approach fixing. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-22 by @gfwilliams Well, it's because there are still open HTTP connections - However I don't know whether that is because the server isn't closing the connection, or because somehow Espruino isn't responding to what the ESP8266 says. What happens if you check the memory usage one minute later? If it's lower then it may well be that the server isn't closing the connection. And you're not getting any errors reported? I guess you could use the Does |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-27 by DrAzzy (sorry for multipost, forum is breaking edit window every time I scroll in it...) res.on('close',...) is not being called. Ever, for any of the requests
Here's a log of that "onClose called" is never recorded. I also added that to the more boring ones, and saw the same behavior :-/ So yeah - it looks like on close event isn't being handled on the ESP8266: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-27 by DrAzzy
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-27 by @gfwilliams Well, that's interesting though - |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-30 by DrAzzy Figured out what's going on here. res.on('close') is not called when the body of the response has length of 0 (which is common in REST API's), and the response never seems to get cleared out (presumably the same logic as on('close'). I have no idea how that callback is called, so I can't really pursue it further |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-01 by @gfwilliams Ok, is that specific to the ESP8266 - did it work on CC3k/WIZnet before, or you're developing something new with the ESP8266? Someone had similar problems with CC3000 (I think) earlier, and I'd assumed it was that the connection had closed before the connect callback got called - but it seems that may not be the case. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-01 by DrAzzy I have code running on I think v72 w/wiznet that has been making requests to that api dozens of times a day for weeks since last reset - (not certain of on('close') is being called, but I think it is... there's certainly no memory leak) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-01 by @gfwilliams Strange - Just fixed it. Try this link in a few minutes: http://www.espruino.com/binaries/git/commits/5ae24206fb924569f14265fa57372132356a7a75 It could have been a regression in 1v75. I had to make sockets 'throttle' the amount they read so that data doesn't get lost when piping to something that can't take the data fast enough - that might have introduced the problem I guess. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-01 by DrAzzy Awesome, thanks! I'll give this a try tonight. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-04 by DrAzzy This looks to be working now! Hurray! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-04-20 by DrAzzy
I've got my voice recognition program working on a Pico, using EasyVR2.0.
It works - I can say "Switch Desk" and it switches the desk light on/off, etc by sending an http request over the ESP8266.
Unfortunately, there's a problem. Every time it processes a command, it loses 100 jsvars. It's definitely something I'm doing, but I can't figure out if it's a bug in my code that's just my fault, or
I can't read the trace() output effectively - I see tons of stuff duplicated, and I don't know which is the junk that's my user code, and which is an artifact of the output format.
EasyVR.js (idea is - you tell module to setRecognize(), then that sets the timeout. The EasyVR replies that that was successful, triggering the command to start listening. Noise will result in either an error response, or a result response (if the noise was me saying "Nixie" or w/e), and then fires the appropriate callback
Beta Was this translation helpful? Give feedback.
All reactions