-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[BUG]WEB Server reset module randomly (Watchdog Reset with Watchdog disabled) #428
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
Comments
Do you monitor your heap()? |
not on this sketch, but on my project Yes, and was always over 20k when resetting, that is why I wrote I did not saw any memory leak I used system_get_free_heap_size() to check at each refresh |
if have another way to monitor - I would be more than happy to check |
Even inside those routines? To be sure perhaps some Serial.println() into ESP8266WebServer::send and related stuff. When I used web server first time, holding down F5 in IE killed it instantly, see #230. |
no I did just before server.send nothing inside the function send itself because it gave me always more than 20000 when it reset, so far from an out of memory |
Using the test skech I provided - heap is 28880 as a constant after send function |
actually seems memory is fluctuating after several minutes:
then before to reset:
I do not know if it help in some way as this is far from out of memory what "cause:1" means ? |
as far as I see, nothing about this causes is really documented... 25k looks more than ok. I'm out of ideas on that problem. Other than as wild guesses like "check power supply", the root of all evil. |
it happen when connect to PC using USB-Serial adapter and when directly connected to printer on 3.3V |
You shouldn't power this module with the USB port. Its power consumption is pretty considerable when it is transmitting. |
Who knows? I didn't hook up the power usage to an ozsi (perhaps I should). I assume that the wifi-send-stuff needs most of the energy. And whatever might happen at random moments while two stations talking together, a cat walking throu the beam and then your stuff sucking the remaining 1 mA... But again, who knows? I attach a 1A-supply, some caps and forget it. |
Ok I have plugged my ESP01 to a 2A power supply and module is still resetting after 1h of web query So I guess issue is software not power |
Do you have AP running? |
no it is station mode - ESP01 is connected to an AP using DHCP |
I get a lot of resets, for no reason when running in AP mode. Still to get to the bottom of it... |
I'm actually having new issues with the web server. it just stops responding after around 2 minutes of up time. I've debugged extensively, tried different IDEs, looked at heap... The ESP is working fine.. |
perhaps cause relates to enum rst_reason { |
if I comment ESP.wdtDisable(); and add several ESP.wdtFeed(); I got reset after few minutes
|
If Watchdog is disabled => reset is watchdog So if behavior is inconsistent it looks like memory management issue |
Watchdog reset/disable functions don't do anything because watchdog API has not been released by Espressif. We need to replace the WDT handling with our own code and then expose that in the API but I haven't yet started doing that. |
Ok thanks - I was relying on Readme Thanks a lot for your great job |
Waiting for the WD functions implementation - is there any way to disable Watchdog manually ? |
You should not need to disable watchdog unless you are running some long timing-critical operations (bitbanging serial addressable LEDs, for instance). |
Well so then you means there is a bug in web server code ? |
Yes, that's very likely the case here. |
Anything I can do to help to find the root cause ? |
You can try enabling debug info uncommenting the DEBUGV definition in debug.h (that's in core directory) and adding |
Ok doing modifications you asked I got this: :ur 1 WS:dis WS:ac :ref 1 WS:av :ref 2 :ur 2 :rn 420 :ref 2 :wr :sent 173 :rcla :abort :ww 28368 :ur 1 WS:dis WS:ac :ref 1 WS:av :ref 2 :ur 2 :rn 420 :ref 2 :wr :sent 173 :rcla :abort :ww 28776 :ur 1 WS:dis WS:ac :ref 1 WS:av :ref 2 :ur 2 :rn 420 :ref 2 Fatal exception (9): ets Jan 8 2013,rst cause:1, boot mode:(1,7) |
Could you please upload the HelloServer.cpp.elf file somewhere? Alternatively, you can run |
@luc-github thank you. I will try this tomorrow morning. Love you and @igrr :) |
Thank YOUUUU @igrr !!! 👍 |
Ok I cannot reproduce any issue with test sketch, but still get this one (several times) with my project which looks close to the one I got before on with test sketch : The same project was running 8 h without issue.
any idea what lead this kind of error ? so I can narrow to a test sketch |
Looks like memory leak - as doing nothing ( refresh is only a 3s and I do not push any button) after few may be 1 minutes the memory drop from 26K to 17K then to 10K then crash in 4 loops I will try to narrow down |
Hi Its not a memory leak. I faced the same issue but then later realised that there is a bit of latency before heap cleaning process kicks in. It starts after every 30-45 seconds and the memory is reclaimed within 1minute. Try triggering after 15 seconds. It will give you good results. |
well I do not think it is the case - because if it was claiming issue, memory should decrease at each loop until no more memory. the program was running 8h without issue, without any modification, I restarted and issue happened, I restarted and the program was running without issue during several minutes with a constant value over 25k for |
@luc-github just to make sure i understood correctly, heap usage is constant for several minutes, and then increases rapidly within a few seconds? Is this with the button example you had posted yesterday? |
@luc-github @igrr Now(latest staging version) I also have exception(28): ctx: sys
|
@bbasil2012 staging has not been updated with yesterday's fixes, so you are seeing old behaviour. |
@igrr Yes - this is correct |
Okay, thanks for the effort! |
@luc-github I tried replacing the two folders "libraries" and "tools" with the one I downloaded from github but my sketch would'nt even compile :( It just hangs halfway through. So I downloaded the staging board definition and the sketch compile again but from the post by igrr above, the changes are not yet included. any idea when this will happen? |
@bbasil2012 could you please share the sketch you use so I can troubleshoot this issue? |
@igrr My sketch is big. It is include many separated files in summary about 54kb |
OK I have simple sketch to reproduce Exception(28) but not sure it is relevant if fill with 272 in the loop ,no crash
|
When String needs more memory, it allocates new buffer, copies its contents, and then releases the old buffer. So there is a moment when you have two buffers allocated at the same time. 2*11K = 22K which is indeed close to the total free heap available. Now it would indeed be better if the system would at least print something like "not enough heap" before crashing. But I feel this is a separate issue... |
I was not able to do a short sketch to reproduce the error I saw with my project, so I have applied the workaround I found for the String size - to use a reserve(10000) - and I am no more able to reproduce the issue = so I guess it is same problem. about memory checking yes it is another issue but can be the root cause of several issues, i saw several usage of
I would add some check like this one, but I do not know if return code is really used
|
@igrr So I think issue can be closed as exception(38) is another issue, not related to webserver itself |
The one I have fixed yesterday wasn't related to web server either. It was just easier to reproduce it with webserver because it happens to use Strings a lot, hence more chances hitting heap corruption issue. |
agreed - thanks a lot for your great work 👍 |
hi guys. Is this the same issue? http://i.imgur.com/gCp89u2.png� This is my code: https://github.com/psYbR/dual-esp8266-controller/blob/master/esp8266_controller.ino Am totally new to microcontrollers in general and learning as I go, just wanted to ask before I attempt to update my libraries with the fix from this thread. Cheers |
I can reproduce your issue with your code with latest staging which has the fix - so issue is there |
thanks @luc-github. Any idea how I can work around this issue for now? ie an alternate method? I need good stability for my project or it won't really work. |
Same here .- it is over my skills - need to wait for @igrr feedback |
Hi I am using staging module and I compile using 1.6.4 under windows 7 64bit
I use ESP8266 01 to be a bridge between 3D printer and a web browser to get printer information, for this I do a request every 2 seconds to refresh the content of the web page and this make the module to reset randomly.
it happens even watchdog is disabled ( between 10min to 8h)
I open 2 web pages at once to make it happen faster
if no pages open the module do not reset at least within 48h ( I did not tested longer)
so currently can be String issue (but did not saw any memory leak) or Webserver issue but I do not know what to test
Is it a known issue ?
I there anything wrong in the code ?
or anything that should be added to prevent module reset ?
Thanks in advance
I narrow down the minimal code using helloserver.ino to reproduce the problem (IP is harcoded to limit the usage of any function)
The text was updated successfully, but these errors were encountered: