Closed dennyem closed 1 year ago
Sorry, I have to wait until you prove this is a bug of the library, and not what's wrong with your system, code, usage, etc. as last time in Page fails to load when exceeding 2373 bytes of text/html #7
Please understand that examples are just examples to demo the basic features of the library. Don't rely on and follow every line of them for your use-cases. Question why many other people are still OK with regular applications using the library. Even said so, I'm sure any library still has swarm of bugs, waiting for good users to help kill them.
You also have to realize that time is precious for everyone everywhere.
I'm closing the issue now until you prove the bug.
Sorry, I have to wait until you prove this is a bug of the library, and not what's wrong with your system, code, usage, etc. as last time in Page fails to load when exceeding 2373 bytes of text/html #7
Please understand that examples are just examples to demo the basic features of the library. Don't rely on and follow every line of them for your use-cases. Question why many other people are still OK with regular applications using the library. Even said so, I'm sure any library still has swarm of bugs, waiting for good users to help kill them.
You also have to realize that time is precious for everyone everywhere.
I'm closing the issue now until you prove the bug.
I understand the nature of examples and I am using the one provided to easily show reproducible results and to prove my application code is not at fault. I encountered this problem when porting existing code from an ESP32 using ESPAsyncWebServer. The ESP32 code has been running for over a year with no problems but the port to rPi Pico failed to display on the browser (Firefox and Microsoft Edge). I get the same results when compiling using Arduino 1.8.19. Do you have a working example that contains a web page with larger code size for me to test on my system?
I have just completed a fresh install of Windows 10 on a virgin laptop, installed from scratch the latest downloaded Arduino IDE 2, loaded the AsyncWebServer_RP2040 library, opened the supplied AsyncWebSocketsServer example, changed the SSID and password and increased the size of the HTML section in webpage.h as per my test case. Nothing else was installed in the way of applications, libraries or other code and, IT FAILS. I cannot believe the problem can be anything other than the library. Would you please duplicate my test case and advise.
I have just tried changing the SSID to a different router. The problem still occurs but with a larger html page size. Looking at the console log from a page that did load I got (Notice the last line "connection interrupted"):
TSS: content-tss.js loaded: http://192.168.0.135/ content-scripts.js:1:118223
INS: content-blocked-items.js loaded: http://192.168.0.135/ content-scripts.js:1:138261
GET TAB ID RESPONSE:
Object { tabId: 1 }
content-scripts.js:1:119759
CONTENT_SHELL: Page allowed. Skipping shell injection blocks content-scripts.js:1:137923
TSS: excluded result:
Object { excluded: true }
content-scripts.js:1:128944
TSS: Excluding content tss (trigger: send-mesage) content-scripts.js:1:120296
The connection to ws://192.168.0.135/ws was interrupted while the page was loading. 192.168.0.135:56:13
Hi @dennyem
Check the new release AsyncWebServer_RP2040W v1.4.1 with some examples to demo how to send large (50KB even much larger) html
in chunks
Hopefully you can adapt them to your use-case.
Good Luck,
beginChunkedResponse()
to send large html
in chunksallman astyle
and add utils
Following is debug terminal output when running example AsyncWebServer_SendChunked on RASPBERRY_PI_PICO_W using CYW43439 WiFi, to demo how to use beginChunkedResponse()
to send large html
in chunks
Start AsyncWebServer_SendChunked on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
AsyncTCP_RP2040W v1.1.0
AsyncWebServer_RP2040W v1.4.1
Connecting to SSID: HueNet1
SSID: HueNet1
Local IP Address: 192.168.2.77
Country code: XX
AsyncWebServer is @ IP : 192.168.2.77
.[AWS] Total length to send in chunks = 47387
[AWS] Bytes sent in chunk = 11560
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 811
[AWS] Bytes sent in chunk = 0
.[AWS] Total length to send in chunks = 47387
[AWS] Bytes sent in chunk = 11560
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 811
[AWS] Bytes sent in chunk = 0
[AWS] Total length to send in chunks = 47387
[AWS] Bytes sent in chunk = 11560
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 811
[AWS] Bytes sent in chunk = 0
.[AWS] Total length to send in chunks = 47387
[AWS] Bytes sent in chunk = 11560
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 811
[AWS] Bytes sent in chunk = 0
[AWS] Total length to send in chunks = 47387
[AWS] Bytes sent in chunk = 11560
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 11672
[AWS] Bytes sent in chunk = 811
[AWS] Bytes sent in chunk = 0
.[AWS] Total length to send in chunks = 47387
[AWS] Bytes sent in chunk = 11560
...... ...
I have just completed a fresh install of Windows 10 on a virgin laptop, installed from scratch the latest downloaded Arduino IDE 2, loaded the AsyncWebServer_RP2040 library, opened the supplied AsyncWebSocketsServer example, changed the SSID and password and increased the size of the HTML section in webpage.h as per my test case. Nothing else was installed in the way of applications, libraries or other code and, IT FAILS. I cannot believe the problem can be anything other than the library. Would you please duplicate my test case and advise.
It may be a good idea to try one of the STANDARD library examples in the SDK that are not using this AsyncWebServer library. As I had problems some time ago when I tried the Async library, so tried the basic NON async library, this exhibited the same problem, pointing to the underlying SDK as the route cause. This in turn lead to a long debug investigation, where the faults were not reproducible between different people, but the cause was eventually traced to issues in Phil's underlying driver, which he re-wrote, and that appeared to solve my issues. So can you try testing using the NON async examples?
When trying to serve pages of say <1K bytes (which is what most examples provided do) everything works ok.
When increasing the html content the program will get to a point where the page does not load and the browser will just sit there as if waiting for input. My investigation seems to indicate a figure of 2373 bytes total (html/css/script) for it to fail.
Take the example "Async_WebSocketsServer.ino" provided with the library. Change the SSID and password but nothing else. Compile and run. All works as expected.
Now increase the content of the single html line in the body of "webpage.h" RP2040W AsyncSocketServer by adding ABCDEFGHIJKLMNOPQRSTUVWXYZ to the end.
The line now looks like this (h1 tags ommited here for clarity) RP2040W AsyncSocketServerABCDEFGHIJKLMNOPQRSTUVWXYZ
Compile and test just to make sure you didn't stuff up the html. Still works ok yes.
Now duplicate that line 30 times, compile and run, see what happens in the browser when you access the url for the Pico, it hangs. If you cut down the html content progressively you will reach a point where it works.
Expected behavior
Browser should display the page of repeated html text irrespective of the number of lines.
Actual behavior
Browser hangs when a certain size of html text is served.
Information
Arduino IDE 2.0.1 RP2040 core v2.3.3 RASPBERRY_PI_PICO_W Windows 11
Context: I encountered a crash while using this library