-
Notifications
You must be signed in to change notification settings - Fork 116
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
Error 112 on ESP32 #62
Comments
Hi there, first things first: Thanks Jean-Christophe for conceiving this excellent piece of software! While developing the Terkin Datalogger [1] (as well on ESP32 with Pycom MicroPython), we probably experienced the same thing as @arpadtamasi: 22.3080 [terkin.api.http ] INFO : Setting up HTTP API
22.4902 [terkin.api.http ] INFO : Starting HTTP server
Traceback (most recent call last):
File "main.py", line 65, in <module>
File "main.py", line 60, in main
File "/flash/lib/terkin/datalogger.py", line 130, in start
File "/flash/lib/terkin/device.py", line 211, in start_network_services
File "/flash/lib/terkin/network/core.py", line 70, in start_httpserver
File "/flash/lib/terkin/api/http.py", line 54, in start
File "dist-packages/microWebSrv.py", line 224, in Start
OSError: [Errno 12] ENOMEM -- Program crashes when webserver is started twice We compensated for that by checking for def start(self):
if self.webserver.IsStarted():
log.info('HTTP server already started')
else:
log.info('Starting HTTP server')
self.webserver.Start(threaded=True) So, the reason for your observation could be that the code might be attempting to start the webserver twice. With kind regards, [1] https://github.com/hiveeyes/hiveeyes-micropython-firmware |
@amotl thanks, you are right. It happens to me when - during development - I download a new version of my main.py to ESP32. In this case I don't have access to the variable declared in the old version so cannot call IsStarted |
Dear Árpád, thanks for confirming these observations and also thanks for clarifying what you mean by "download" - I already became curious to ask ;]. In order to work around the "lost reference" problem, we just declared a global variable for holding that reference. For us, it is a "module-wide global" variable, living inside the namespace of This module-wide global variable just called Maybe this helps. With kind regards, [1] https://github.com/hiveeyes/hiveeyes-micropython-firmware/blob/0deb953a4d241bb78ccf6aae76c932bcbb9fe95b/terkin/api/http.py#L30-L31 |
Thanks, I give it a shot. I have no experience with Python neither with ESP that's why I'm confused. I'm just building a toy robot with my kids. |
I see. Just throwing in a webserver sounds easy, right? However, I believe you will make it. Just forget about the module stuff I have been rambling about, stay flat with your
Good luck and enjoy the ride. Let me know if you need any further help. From the top of my head, if you are playing with the webserver, you maybe want to amend it slightly in order to see any exceptions coming from the handler methods. Let me know when you are hitting a wall there. |
$ diff -u dist-packages/microWebSrv.py var/microWebSrv.py | colordiff
--- dist-packages/microWebSrv.py 2019-08-02 17:11:03.000000000 +0200
+++ var/microWebSrv.py 2019-08-02 17:14:50.000000000 +0200
@@ -375,6 +375,7 @@
else :
response.WriteResponseBadRequest()
except :
+ print('ERROR handling webserver request\n', get_last_stacktrace())
response.WriteResponseInternalServerError()
try :
if self._socketfile is not self._socket:
@@ -861,3 +862,12 @@
# ============================================================================
# ============================================================================
+
+import sys
+import uio
+
+def get_last_stacktrace():
+ buf = uio.StringIO()
+ exc = sys.exc_info()[1]
+ sys.print_exception(exc, buf)
+ return buf.getvalue() |
Hi amotl, I tried to follow your work around but it didn't work. My code looks like this: Getting this error: File "", line 27, in Thanks |
It's failing here: |
Same TCP port already open ? |
I've tried with different ports without any success. There's nothing else in my code using the same port. Thanks. |
Ok, it's strange that you have this error 112. |
Hello,
I released a fully new version (v2.0) of my web server here :
github.com/jczic/MicroWebSrv2.
Open source MIT, fully asynchronous, more robust, more fast and more
efficient!
It is delivered with a good documentation.
Thank you for your support and feedback.
|
Perfect mate,
Gonna give it a try.
Thanks a lot.
Jose Zuma
…________________________________
From: J-Christophe Bos <[email protected]>
Sent: Sunday, October 20, 2019 1:39:34 PM
To: jczic/MicroWebSrv <[email protected]>
Cc: Jose Zuniga Marin <[email protected]>; Comment <[email protected]>
Subject: Re: [jczic/MicroWebSrv] Error 112 on ESP32 (#62)
Hello,
I released a fully new version (v2.0) of my web server here :
github.com/jczic/MicroWebSrv2.
Open source MIT, fully asynchronous, more robust, more fast and more
efficient!
It is delivered with a good documentation.
Thank you for your support and feedback.
I've tried with different ports without any success.
There's nothing else in my code using the same port.
Thanks.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#62?email_source=notifications&email_token=AAD2ALAWYDIGBL57DA3VSPDQPBLSJA5CNFSM4IIFN4KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBP5WQA#issuecomment-543152960>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD2ALALCK5EQJCSFWOHL6LQPBLSJANCNFSM4IIFN4KA>
.
--
*Sincèrement,*
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#62?email_source=notifications&email_token=ABSFDHJE76C3DFLF4LRFKPLQPQ7PNA5CNFSM4IIFN4KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBYIFPQ#issuecomment-544244414>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABSFDHO2UOAJMSXGJQVS7DDQPQ7PNANCNFSM4IIFN4KA>.
|
During development every time I download a new version, I got the following trace:
Traceback (most recent call last):
File "", line 1, in
File "", line 34, in
File "microWebSrv.py", line 224, in Start
OSError: 112
The text was updated successfully, but these errors were encountered: