Skip to content
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

Not compatible with Micropython 1.21.0? #99

Open
kenjican opened this issue Nov 29, 2023 · 10 comments
Open

Not compatible with Micropython 1.21.0? #99

kenjican opened this issue Nov 29, 2023 · 10 comments

Comments

@kenjican
Copy link

  MicroWebSrv2  2.0.6 have been working well with MicroPython V.1.20.0 and versions before.

  But , at version Micropython 1.21.0 , when connecting it shows  server closed as below:

MWS2-INFO> Server listening on 0.0.0.0:80.
MWS2-INFO> Starts the managed pool to wait for I/O events.
MWS2-INFO> Server 0.0.0.0:80 closed.
MWS2-INFO> Stops the managed pool.

Anyone bump into this problem also?

@jczic
Copy link
Owner

jczic commented Jan 25, 2024

Is this still the case after the recent commits?

@kenjican
Copy link
Author

I tried recent commits and Micropython 1.22.1 。 Sever not closed but still can not open the html page. as below:
---------------------------
- Python pkg MicroWebSrv2 -
- version 2.0.6 -
- by JC`zic & HC2 -
---------------------------

  • [@webroute] GET /scan
  • [@webroute] POST /saveJson
  • [@webroute] GET /reset
  • [@webroute] POST /cmds
    MWS2-INFO> Server listening on 0.0.0.0:80.
    MWS2-INFO> Starts the managed pool to wait for I/O events.

@ekondayan
Copy link

Same here. Breaking commit is 2f1e982. The server starts and hangs on MWS2-INFO> Starts the managed pool to wait for I/O events.
When I try to open a webpage the curl/browser hangs and also the webserver hangs. If I try to stop it with CTRL+C it doesn't responds for about 30 seconds before the key presses get registered and the server stops

Micropython versions tested: 1.22.2 and all in between the latest master
ESP-IDF versions tested: latest 5.1 and 5.2

@jczic
Copy link
Owner

jczic commented Mar 15, 2024

Hello and thank you for your feedback.
can you try to start the server with :
StartManaged(0)
or
StartManaged(2)
?

@ekondayan
Copy link

With StartManaged(2) the server hangs and even CTRL+C does not work
With StartManaged(0) I am able to halt the server with CTRL+C. Once I was able to download the index.html, but even then the server responded about 20 seconds later and then hanged again.

Here is the output when I stop it with CTRL+C

MWS2-INFO> Server listening on 0.0.0.0:80.
MWS2-INFO> Starts the managed pool to wait for I/O events.

hit 5-10 times CTRL+C

MWS2-INFO> Server 0.0.0.0:80 closed.
MWS2-INFO> Stops the managed pool.
Traceback (most recent call last):
...
File "MicroWebSrv2/microWebSrv2.py", line 222, in StartManaged
File "MicroWebSrv2/microWebSrv2.py", line 238, in Stop
File "MicroWebSrv2/libs/XAsyncSockets.py", line 270, in StopWaitEvents
KeyboardInterrupt:
MicroPython v1.23.0-preview.233.gafeba9050 on 2024-03-15;

I'd like to help you debug it, but I do not know where to start.

@recklessop
Copy link

recklessop commented Mar 17, 2024

Same problem here. Server starts but cannot get to any routes. (1.22.0 here too)

update:
I rolled back to 1.20 Micropython and 2.0.6 of MicroWebSrv2 and I am now able to get responses from the webserver.

Not that I am running this on an ESP32-Wroom in embedded mode. So I can confirm what @ekondayan was saying about the commit breaking things.

@ekondayan
Copy link

I've been testing the latest commit (4a7f599) - it is still not working reliably but this time with a twist.

This time I am able to get the index.html a few times in a row(using curl) but then the server stops serving again. I wasn't able to get a complete webpage using a regular browser - index.html, CSS and two JS files( 420KB in total ). The difference now is that I can get at least one index.html served but the server blocks for the rest of the page assets. I also noted that in this blocked state, the server is handling the websocket messages correctly.

If you give me a modified XAsyncSockets.py, stuffed with debug print statements, I can send you the output.

@jczic
Copy link
Owner

jczic commented Mar 28, 2024

Hmm, thank you @ekondayan.
Strange indeed.
And how do you start the server at the beginning?
I use it on big projects with TLS/SSL (on Azure cloud) and it still works. I launch it with 5 parallel processes.
Do you use it in embedded mode or on a normal server (linux or other)?

@ekondayan
Copy link

    mws2 = MicroWebSrv2()
    mws2.RootPath = '/www'
    mws2.SetEmbeddedConfig()  # For embedded MicroPython, use a very light configuration,
    mws2.DisableSSL()
    mws2.NotFoundURL = '/'  # All pages not found will be redirected to the home '/',
    mws2.StartManaged()

My environment is:

  • ESP32-PICO-D4 - 2MB RAM and 8MB flash.
  • Micropython - master branch(I've also tested some commits between the latest master and v1.22.2) compiled with ESP-IDF v5.2. I've also tested to compile with ESP-IDF v5.1.

@ekondayan
Copy link

I've tested the latest commit and it still does not work on esp32 with micropython

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants