[ST Edge] - Fatal error from socket.http

I had a LAN driver crash and spontaneously restart in the following scenario:

Following 2 HTTP requests that resulted in timeouts (and concluded normally), a third HTTP request was then sent to an IP that exists and a port that doesn’t exist. As expected, it returned a ‘connection refused’ and my function appeared to complete normally. However about 11 seconds later, I got the following error:

WARN WLED Driver received data on non-existent socket: tcp_send_ready, bb07f167-e9c2-418d-9160-16bde5257fb4

This mesage shows some progress, since this error used to be fatal and would halt the driver, so thank you for addressing that one. Unfortunately this was immediately followed by a new fatal error I haven’t seen before:

FATAL WLED Driver Lua: runtime error: [string “socket”]:1469: socket_receive returned no error and no socket

And this error caused the driver to spontaneously restart. Fortunately the restart was successful and the driver seemed to continue normally.


Firmware version: 000.041.00005
Here is the log showing the sequence:

2021-12-29T22:45:27.886579515+00:00 DEBUG WLED Driver  Sending:	http://192.168.100.5:80/win&T=0&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:45:30.906887264+00:00 INFO WLED Driver  response code=<[string "socket"]:1407: timeout>, status=<nil>
2021-12-29T22:45:30.918603972+00:00 WARN WLED Driver  HTTP request timed out: 	192.168.100.5:80
2021-12-29T22:45:30.922071431+00:00 ERROR WLED Driver  HTTP Request failed:	Timeout
2021-12-29T22:45:30.925643847+00:00 DEBUG WLED Driver  WLED Driver device thread event handled
2021-12-29T22:46:27.913005854+00:00 TRACE WLED Driver  Received event with handler capability
2021-12-29T22:46:27.936463396+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> received command: {"args":[],"capability":"switch","positional_args":[],"command":"on","component":"main"}
2021-12-29T22:46:27.940122104+00:00 TRACE WLED Driver  Found CapabilityCommandDispatcher handler in thisDriver
2021-12-29T22:46:27.946436396+00:00 INFO WLED Driver  Switch pressed
2021-12-29T22:46:27.968262479+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> emitting event: {"component_id":"main","attribute_id":"level","capability_id":"switchLevel","state":{"value":100}}
2021-12-29T22:46:27.980454146+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> emitting event: {"component_id":"main","attribute_id":"switch","capability_id":"switch","state":{"value":"on"}}
2021-12-29T22:46:28.000097187+00:00 INFO WLED Driver  COMMAND STRING TO SEND:	/win&T=1&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:46:28.003677187+00:00 DEBUG WLED Driver  Sending:	http://192.168.100.5:80/win&T=1&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:46:31.033101896+00:00 INFO WLED Driver  response code=<[string "socket"]:1407: timeout>, status=<nil>
2021-12-29T22:46:31.044338521+00:00 WARN WLED Driver  HTTP request timed out: 	192.168.100.5:80
2021-12-29T22:46:31.047928271+00:00 ERROR WLED Driver  HTTP Request failed:	Timeout
2021-12-29T22:46:31.051516729+00:00 DEBUG WLED Driver  WLED Driver device thread event handled
2021-12-29T22:46:58.392212733+00:00 TRACE WLED Driver  Received event with handler device_lifecycle
2021-12-29T22:46:58.399295608+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> received lifecycle event: infoChanged
2021-12-29T22:46:58.419217066+00:00 TRACE WLED Driver  Found DeviceLifecycleDispatcher handler in thisDriver
2021-12-29T22:46:58.425574691+00:00 DEBUG WLED Driver  Info changed handler invoked
2021-12-29T22:46:58.428947649+00:00 DEBUG WLED Driver  Time since last info_changed:	100.65799999237
2021-12-29T22:46:58.432145191+00:00 INFO WLED Driver  Host address changed to: 	192.168.1.5:8099
2021-12-29T22:46:58.438726066+00:00 DEBUG WLED Driver  WLED Driver device thread event handled
2021-12-29T22:47:03.078251150+00:00 TRACE WLED Driver  Received event with handler capability
2021-12-29T22:47:03.087437608+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> received command: {"args":[],"capability":"switch","positional_args":[],"command":"off","component":"main"}
2021-12-29T22:47:03.094667150+00:00 TRACE WLED Driver  Found CapabilityCommandDispatcher handler in thisDriver
2021-12-29T22:47:03.098185525+00:00 INFO WLED Driver  Switch pressed
2021-12-29T22:47:03.107869858+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> emitting event: {"component_id":"main","attribute_id":"switch","capability_id":"switch","state":{"value":"off"}}
2021-12-29T22:47:03.128335942+00:00 INFO WLED Driver  COMMAND STRING TO SEND:	/win&T=0&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:47:03.131831400+00:00 DEBUG WLED Driver  Sending:	http://192.168.1.5:8099/win&T=0&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:47:06.166198150+00:00 INFO WLED Driver  response code=<[string "socket"]:1407: timeout>, status=<nil>
2021-12-29T22:47:06.169904484+00:00 WARN WLED Driver  HTTP request timed out: 	192.168.1.5:8099
2021-12-29T22:47:06.173388817+00:00 ERROR WLED Driver  HTTP Request failed:	Timeout
2021-12-29T22:47:06.176894734+00:00 DEBUG WLED Driver  WLED Driver device thread event handled
2021-12-29T22:47:25.174158486+00:00 TRACE WLED Driver  Received event with handler device_lifecycle
2021-12-29T22:47:25.184917236+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> received lifecycle event: infoChanged
2021-12-29T22:47:25.218468361+00:00 TRACE WLED Driver  Found DeviceLifecycleDispatcher handler in thisDriver
2021-12-29T22:47:25.221785778+00:00 DEBUG WLED Driver  Info changed handler invoked
2021-12-29T22:47:25.225088694+00:00 DEBUG WLED Driver  Time since last info_changed:	26.796000003815
2021-12-29T22:47:25.231790861+00:00 INFO WLED Driver  Host address changed to: 	192.168.1.104:8099
2021-12-29T22:47:25.238544778+00:00 DEBUG WLED Driver  WLED Driver device thread event handled
2021-12-29T22:47:28.875946361+00:00 TRACE WLED Driver  Received event with handler capability
2021-12-29T22:47:28.891121778+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> received command: {"args":[],"capability":"switch","positional_args":[],"command":"on","component":"main"}
2021-12-29T22:47:28.894673570+00:00 TRACE WLED Driver  Found CapabilityCommandDispatcher handler in thisDriver
2021-12-29T22:47:28.906070778+00:00 INFO WLED Driver  Switch pressed
2021-12-29T22:47:28.911042528+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> emitting event: {"component_id":"main","attribute_id":"level","capability_id":"switchLevel","state":{"value":100}}
2021-12-29T22:47:28.922092570+00:00 INFO WLED Driver  <Device: 9b05641e-372d-4020-b390-7ac7f48049cd (WLED Driver)> emitting event: {"component_id":"main","attribute_id":"switch","capability_id":"switch","state":{"value":"on"}}
2021-12-29T22:47:28.941473236+00:00 INFO WLED Driver  COMMAND STRING TO SEND:	/win&T=1&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:47:28.947904778+00:00 DEBUG WLED Driver  Sending:	http://192.168.1.104:8099/win&T=1&SB=255&HU=62986&SA=87&FX=8&RV=0&SS=0&SV=1
2021-12-29T22:47:28.975895861+00:00 INFO WLED Driver  response code=<[string "socket"]:1407: connect failed (192.168.1.104:8099): Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }>, status=<nil>
2021-12-29T22:47:28.988597945+00:00 WARN WLED Driver  Connection refused: 	192.168.1.104:8099
2021-12-29T22:47:28.992287903+00:00 ERROR WLED Driver  HTTP Request failed:	Refused
2021-12-29T22:47:28.995861903+00:00 DEBUG WLED Driver  WLED Driver device thread event handled
2021-12-29T22:47:40.461879196+00:00 WARN WLED Driver  received data on non-existent socket: tcp_send_ready, bb07f167-e9c2-418d-9160-16bde5257fb4
2021-12-29T22:47:40.473654279+00:00 FATAL WLED Driver  Lua: runtime error: [string "socket"]:1469: socket_receive returned no error and no socket
stack traceback:
	[string "socket"]:1469: in field 'select'
	[string "runner/src/packagesearcher.rs:21:10"]:303: in field 'run'
	[string "runner/src/packagesearcher.rs:21:10"]:743: in method 'run'
	[string "init.lua"]:462: in main chunk