Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WebSocketsServerCore::handleNewClient calls WebSocketsServerCore::dropNativeClient(client) if !client. #728

Closed
JonathanJamesStewart opened this issue Dec 26, 2021 · 0 comments

Comments

@JonathanJamesStewart
Copy link

Stack trace.

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4017d5f7  PS      : 0x00060130  A0      : 0x800dcf1d  A1      : 0x3ffd9810  
A2      : 0x3ffd6834  A3      : 0x00000000  A4      : 0x00000005  A5      : 0x3ffd6c60
A6      : 0x00000001  A7      : 0x000000cc  A8      : 0x800dce1f  A9      : 0x3ffd97f0
A10     : 0x00000001  A11     : 0x3ffd6b94  A12     : 0x00000000  A13     : 0x3ffd9818  
A14     : 0x00000004  A15     : 0x3ffc625c  SAR     : 0x0000001b  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000008  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

ELF file SHA256: 0000000000000000

Backtrace: 0x4017d5f7:0x3ffd9810 0x400dcf1a:0x3ffd9830 0x400dcf51:0x3ffd9850 0x400dd861:0x3ffd9870 0x400d70a5:0x3ffd9890 0x400812b1:0x3ffd9930 0x40089d5e:0x3ffd9950
  #0  0x4017d5f7:0x3ffd9810 in WebSocketsServerCore::dropNativeClient(WSclient_t*) at .pio\libdeps\esp32dev\WebSockets\src/WebSocketsServer.cpp:519
  #1  0x400dcf1a:0x3ffd9830 in WebSocketsServerCore::handleNewClient(WiFiClient*) at .pio\libdeps\esp32dev\WebSockets\src/WebSocketsServer.h:200
  #2  0x400dcf51:0x3ffd9850 in WebSocketsServer::handleNewClients() at .pio\libdeps\esp32dev\WebSockets\src/WebSocketsServer.h:200
  #3  0x400dd861:0x3ffd9870 in WebSocketsServer::loop() at .pio\libdeps\esp32dev\WebSockets\src/WebSocketsServer.h:200
  #4  0x400d70a5:0x3ffd9890 in HAServer::loop() at c:\users\jonathan\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\5.2.0\bits/shared_ptr_base.h:127 (discriminator 1)
  #5  0x400812b1:0x3ffd9930 in serverLoop(void*) at c:\users\jonathan\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\5.2.0\bits/shared_ptr_base.h:127 (discriminator 1)
  #6  0x40089d5e:0x3ffd9950 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

I think the issue is here.

WSclient_t * WebSocketsServerCore::handleNewClient(WEBSOCKETS_NETWORK_CLASS * tcpClient) {
    WSclient_t * client = newClient(tcpClient);

    if(!client) {
...
        dropNativeClient(client);
    }
...

Which calls into.

void WebSocketsServerCore::dropNativeClient(WSclient_t * client) {
    if(client->tcp) {
...

If client is null then client->tcp throws a LoadProhibited exception.
Which (probably naively) seems like a simple fix.

void WebSocketsServerCore::dropNativeClient(WSclient_t * client) {
    if (!client)
        return;
    if(client->tcp) {
...
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant