Closed joliclic closed 3 years ago
I have the same issue and I agree with the proposed solution. You could send some defined close code: https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.2
I use version 2.3.5 but I get a slightly different stack result (line numbers):
Core 1 register dump:
PC : 0x4016d807 PS : 0x00060030 A0 : 0x800d7195 A1 : 0x3ffb1f10
A2 : 0x3ffc17f4 A3 : 0x00000000 A4 : 0x00000005 A5 : 0x3ffc1c20
A6 : 0x00000001 A7 : 0x000000cc A8 : 0x800d7097 A9 : 0x3ffb1ef0
A10 : 0x00000001 A11 : 0x3ffc1b54 A12 : 0x00000000 A13 : 0x3ffb1f18
A14 : 0x00000004 A15 : 0x3ffc5548 SAR : 0x0000001b EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000008 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
ELF file SHA256: 0000000000000000
Backtrace: 0x4016d807:0x3ffb1f10 0x400d7192:0x3ffb1f30 0x400d71c9:0x3ffb1f50 0x400d7ad9:0x3ffb1f70 0x400d4096:0x3ffb1f90 0x400db53c:0x3ffb1fb0 0x400899aa:0x3ffb1fd0
EXCVADDR: 0x00000008
Decoding stack results
0x4016d807: WebSocketsServerCore::dropNativeClient(WSclient_t*) at C:\Users\mvrm\Documents\Arduino\libraries\WebSockets\src\WebSocketsServer.cpp line 519
0x400d7192: WebSocketsServerCore::handleNewClient(WiFiClient*) at C:\Users\mvrm\Documents\Arduino\libraries\WebSockets\src\WebSocketsServer.cpp line 622
0x400d71c9: WebSocketsServer::handleNewClients() at C:\Users\mvrm\Documents\Arduino\libraries\WebSockets\src\WebSocketsServer.cpp line 645
0x400d7ad9: WebSocketsServer::loop() at C:\Users\mvrm\Documents\Arduino\libraries\WebSockets\src\WebSocketsServer.cpp line 944
0x400d4096: loop() at C:\data\personal\huis\alarm\alarm-front/alarm-front.ino line 60
0x400db53c: loopTask(void*) at C:\Users\mvrm\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32\main.cpp line 23
0x400899aa: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143```
Any progress or workaround on this issue?
I created a pull request to fix this issue: https://github.com/Links2004/arduinoWebSockets/pull/708
When the number of connected clients exceeds the max défined by WEBSOCKETS_SERVER_CLIENT_MAX, the program crashes and the card reboots.
The following program was used, on a esp8266 card (Wemos D1 mini), with WebSockets 2.3.5. I have tried to modify WEBSOCKETS_SERVER_CLIENT_MAX in WebSocketsServer.h, but for every value the program crashes as soon as I try to connect (value+1) clients. It would be better if the new connection is refused and ignored.
ino:
JavaScript code used in the browser, (client):
The decoded exception: