-
Notifications
You must be signed in to change notification settings - Fork 30
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
Pico W need too much time for receiving request data in random cases #46
Comments
I've run Peterbay's example and can confirm there is a server response lag issue with the Pico W. It's the only board I helped test with. Approximately 216-250ms on average for me. Discord troubleshooting conversation. Running on the latest nightly build from S3 Bucket with updated 8x PY library from Github Adafruit CircuitPython 8.1.0-beta.1-10-g6df88ac94 on 2023-04-05; Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w No idea if this is an HTTPServer or Pico W issue specifically. It seemed to fight web workflow for port 80? I tried changing the server port to 81 but that didn't work. It's only sending 106 bytes so one would reasonably assume the response should be much faster than 250ms. More testing is needed. |
Running web workflow and an adafruit_httpserver simultaneously should be no problem on separate ports. But I'd suggest disabling web workflow for this testing to get cleaner data for this issue. I don't think it's specific to Pico W. On an ESP32-S3, my browser shows typical times of a couple hundred ms. I split up
|
problems upgrading to CP828, 829, 900a5, 900a6 PICO W with web-server and mqtt and mqtt client ( remote command ) i have specific timing issues with while back in February CP802 . 810 it worked. |
Can you provide some more details, maybe even code? I think it is more probable that the library itself changed and not CircuitPython, but I may be wrong as I do not really understand your problem at the moment. |
well, i started to change all code from the 'old' but in February working
to the new version without "HTTP" while the adafruit_minimqtt.adafruit_minimqtt lib looks like it did not change in that time? same about that the mqtt TLS problem what was solved back then, my GIT only has the working version, is bigger project, so how can i help? let's start with the timing of server.poll() with this question? new test see |
The repository you linked is either private or already deleted. I still do not completely understand you problem, but regarding to what I understood:
|
thank for the answer. -1- yes, blocking for short time -2- NOT UNDERSTAND test 3: asyncio import failed -3- yes, i used the latest bundle -4- i made a test2 -5- looks like add to the timing problem there is also a memory problem ( that why i needed many gc.collect ) |
So, regarding the debug mode, it only prints a timing after, and only after handling the response, if Next thing, if importing asyncio fails, you have to install it. I think the Please follow the instruction I attached and i suggest posting your problem on Adafruits IDscord server, there are more people that could help with this. This is also a better place, because I believe at this point we are discussing a specific scenario and not really a issue with library itself. |
sorry, thanks, now i found the TICKS library in the bundle "Please follow the instruction I attached" "not really a issue with library itself."
this might be here as well, i hoped with YOU we can prove it's NOT the library -- sure i asked at Discord server already i now did tests using CP810 HTTPServer ( code changes ) !! back in CP810 i already did use server.poll() NOT in the MAIN loop because of timing issues, |
Please read to the end. I you were using the The library got a lot of upgrades since then, here is the diff between 3.0.2 (latest version that used HTTP... prefix) and most recent version: https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/compare/3.0.2..main#diff-8ebe9b561a5a0efd5ca358f890968beb81364bca15e851add61ee7f09feef016R352 So, the I investigated a bit more and here is what I found: Only 4048 left! As you can see, import fail at But, on CircuitPython 8.2.9, it works normally: So, my guess is, CircuitPython 9.x.x changed something regarding memory allocation. I was able to find this live from Adafruits YT channel, when they show something that looks like the problem presented here. @tannewt maybe you could shine some light onto this? |
thanks!
to your style:
because i wanted to make my code so beautiful pythonic like yours. and the later HTML_INDEX.format() |
i use only
report from inside the test code:
rem: see above, under CP810 i had 50kB more free mem, eaten half half by CP900a6 and httpserver.Server
|
Yes, memory management has changed in 9.x. CP now has an outer heap that persists over multiple VM runs and the VM heap is split into multiple allocations into the outer heap. This will change the mem_free() reporting a bit because it doesn't include absolutely all memory free in the outer heap. It also can make it harder to do large allocations when the outer heap is fragmented. You should make sure to run |
I have a for example a small web page with repeated ajax requests. Page is sending one request per second and server on Pico W needs different times for processing same request. In my case it varies between 40 ms and 250 ms.
I expected the time for processing the request to be approximately in the range of 40 to 80ms.
Connection to Pico is fast and when i added some debug prints to poll() function in server.py, then i found, that the bottleneck is function -
self._receive_header_bytes(conn)
example of printed output (it's not the same sample as shown in image)
example code:
The text was updated successfully, but these errors were encountered: