Coder Social home page Coder Social logo

Comments (11)

gilmaimon avatar gilmaimon commented on July 4, 2024 1

I believe I have a solution:
As you can see from the backtrace, the panic occurs inside WiFiClient which is part of the esp32's Arduino library. That means, the crash is not in my library exactly.
I've tried to reproduce this kind of crash, and I succeeded. All I had to do is to try and connect without a proper WiFi Connection setup on the device.
Please make sure that you have Wifi before calling connect! If you know connecting to a Wifi can time some time, you can try using this snippet:

for(int i = 0; i < NUM_SECONDS_TO_WAIT && WiFi.status() != WL_CONNECTED; i++) {
      Serial.print(".");
      delay(1000);
  }

I don't know how WifiManager works, but you would need to check that library's docs in order to understand how to do something once a connection is established (Using some sort of callback or blocking mechanism)

I am removing the bug tag, please let me know if you manage to fix this.

from arduinowebsockets.

lalten avatar lalten commented on July 4, 2024

Interestingly, it works with wscat:

sudo wscat -l 80
listening on port 80 (press CTRL+C to quit)
client connected
< Hello
< 1243
< 1750
< 2257
< 2763
< 3268
< 3773
< 4278
< 4783
< 5289
< 5795

But even if ArduinoWebSockets can't properly connect, it should not panic the kernel.

Edit: s/should/should not/

from arduinowebsockets.

gilmaimon avatar gilmaimon commented on July 4, 2024

Thank you for the detailed issue. From a glance this seems to be like some bad error handling on my side.
I've labled this issue a bug and will try to re-produce and fix it in a few days.
Meanwhile, it will save me some time if you could:

  • Make sure to are using the latest version of the library (0.4.1)
  • Check if using an esp8266 with the same code and setup works

Thank you

from arduinowebsockets.

lalten avatar lalten commented on July 4, 2024

Hi Gil,
lib version is current master.
platformio.ini:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino

upload_speed = 921600
monitor_speed = 115200

lib_deps =  https://github.com/tzapu/WiFiManager.git#development
            https://github.com/gilmaimon/ArduinoWebsockets

With an ESP8266, same code:

[env:huzzah]
platform = espressif8266
board = huzzah
framework = arduino

upload_speed = 921600
monitor_speed = 115200

lib_deps =  https://github.com/tzapu/WiFiManager.git#development
            https://github.com/gilmaimon/ArduinoWebsockets

Output with sudo wscat -l 80:

*WM: [1] AutoConnect 
*WM: [2] Connecting as wifi client... 
*WM: [1] STA static IP:
*WM: [2] setSTAConfig static ip not set 
*WM: [3] WIFI station disconnect 
*WM: [1] Connecting to saved AP: XXXXXXXX
*WM: [3] Using Password: XXXXXXXX
*WM: [3] WiFi station enable 
*WM: [3] enableSTA PERSISTENT ON 
*WM: [1] connectTimeout not set, ESP waitForConnectResult... 
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS 
*WM: [1] STA IP Address: 192.168.1.92
Connnection Opened
Got a Pong!

Output with sudo websocat -s 80:

*WM: [1] AutoConnect 
*WM: [2] Connecting as wifi client... 
*WM: [1] STA static IP:
*WM: [2] setSTAConfig static ip not set 
*WM: [3] WIFI station disconnect 
*WM: [1] Connecting to saved AP: XXXXXXXX
*WM: [3] Using Password: XXXXXXXX
*WM: [3] WiFi station enable 
*WM: [3] enableSTA PERSISTENT ON 
*WM: [1] connectTimeout not set, ESP waitForConnectResult... 
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS 
*WM: [1] STA IP Address: 192.168.1.92

So no kernel panic (but it also doesn't connect)

from arduinowebsockets.

gilmaimon avatar gilmaimon commented on July 4, 2024

Thank you @lalten, I am on it.
Few things:

  1. Try running the server using: sudo websocat -s 0.0.0.0:80 so it will be able to accept connections outside of localhost. Does it solves your problem?
  2. Panic is surely not something that supposed, so this is considered a bug either way.

from arduinowebsockets.

gilmaimon avatar gilmaimon commented on July 4, 2024

@lalten please let me know if you solved the issue.

from arduinowebsockets.

elielmarcos avatar elielmarcos commented on July 4, 2024

Hey @gilmaimon we are with the same problem, when the server turn off the ws connection the esp32 enter in panic mode and we recieve this error:

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d4ea0  PS      : 0x00060d30  A0      : 0x800d4f74  A1      : 0x3ffdd8b0  
A2      : 0x00000000  A3      : 0x3ffdd8ff  A4      : 0x00000001  A5      : 0x00000001  
A6      : 0x3ffc27e8  A7      : 0x00000001  A8      : 0x00000000  A9      : 0x00000000  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffddf14  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000001  SAR     : 0x0000000a  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000008  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

Backtrace: 0x400d4ea0:0x3ffdd8b0 0x400d4f71:0x3ffdd8d0 0x4014c4a6:0x3ffdd8f0 0x400d84c7:0x3ffdd920 0x400d7d11:0x3ffdd940 0x400d1e21:0x3ffdda80 0x400885dd:0x3ffddac0

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6400
entry 0x400806a8

I'm using the 0.4.2 version now, and with the 0.4.0 i receieve the same error.

from arduinowebsockets.

gilmaimon avatar gilmaimon commented on July 4, 2024

from arduinowebsockets.

elielmarcos avatar elielmarcos commented on July 4, 2024

@gilmaimon , Thank you very much for your quick solution!

Exactly, it's the WiFiClient library that's causing all the problems. I have problems when I am connected to Wi-Fi, after turning off only the WS server the ESP32 is restarted.

My solution was: reinstall esp32 on Arduino with the older version 1.0.1

The newer version (1.0.3) probably updated something from the WiFi library that is causing the problem.

Thank you very much, I hope you find another solution !!!

from arduinowebsockets.

gilmaimon avatar gilmaimon commented on July 4, 2024

@gilmaimon , Thank you very much for your quick solution!

Exactly, it's the WiFiClient library that's causing all the problems. I have problems when I am connected to Wi-Fi, after turning off only the WS server the ESP32 is restarted.

My solution was: reinstall esp32 on Arduino with the older version 1.0.1

The newer version (1.0.3) probably updated something from the WiFi library that is causing the problem.

Thank you very much, I hope you find another solution !!!

Awesome, glad we pinned down the issue! By the way, give the library a star if you liked it. Hopefull that way more people will use and help improve it.

@lalten, please let me know if I can close the issue 👍

from arduinowebsockets.

gilmaimon avatar gilmaimon commented on July 4, 2024

I consider this as resolved.
Please open an issue or contact me for anything else.

from arduinowebsockets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.