gilmaimon/ArduinoWebsockets

ESP32 panics if WebSocket doesn't exist

Nufflee opened this issue · 5 comments

My ESP32 panics when I try to connect to a WebSocket that is not running. This is not what I'd expect, I would expect it to try connecting and if it fails it just tells me that it failed and doesn't make the ESP32 panic.

Everything works as expected once I start the WebSocket.

This issue is closely related to #10 but the conclusion you've come to in this comment is that it only happens when there's not a working WiFi connection but it also happens if the WebSocket is not running.

This is the full panic message:

[E][WiFiClient.cpp:282] setOption(): fail on fd 54, errno: 22, "Invalid argument"
[E][WiFiClient.cpp:365] write(): fail on fd 54, errno: 104, "Connection reset by peer"
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x40122d4c  PS      : 0x00060830  A0      : 0x80123129  A1      : 0x3ffb1b70
A2      : 0x00000000  A3      : 0x3ffb1bcf  A4      : 0x00000001  A5      : 0x00000001
A6      : 0x00000000  A7      : 0xffffffa7  A8      : 0x00000000  A9      : 0x00000000
A10     : 0x00000000  A11     : 0x3ffc8660  A12     : 0x00000000  A13     : 0x3f4108b2
A14     : 0x00000000  A15     : 0x00000001  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000008  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

Backtrace: 0x40122d4c:0x3ffb1b70 0x40123126:0x3ffb1b90 0x4016250a:0x3ffb1bc0 0x400d3daf:0x3ffb1bf0 0x400d3a36:0x3ffb1c10 0x400d466a:0x3ffb1d50 0x400d1e69:0x3ffb1f40 0x400d7f2b:0x3ffb1fb0 0x40088ea9:0x3ffb1fd0

Rebooting...

Thank you, I will look into it and let you know what I found out.

Gil.

Can you try version 0.4.9 and tell me if its working as expected for you?

This is just a bug with WiFiClient most probably, but I found an interesting way around it. Also this gives me some ideas about tests I should have to make sure it's not me using the library (WiFiClient) in a wrong way..

Thanks,
Gil.

This is basically the same workaround I did myself after a bit of debugging so I'm pretty sure it would work. I will take a look tomorrow and hopefully remember to report back.

Thank you for the quick response!

This is basically the same workaround I did myself after a bit of debugging so I'm pretty sure it would work. I will take a look tomorrow and hopefully remember to report back.

Thank you for the quick response!

Cool. Notice also that I've opened an issue on the Arduino-Esp32 project espressif/arduino-esp32#3056

They say it was resolved and will be pushed in the next release.

Hopefully they will fix that soon.
Gil.

Can I mark as resolved?