-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when streaming data over UDP #3672
Comments
Can you confirm (by adding DEBUG_PRINTs) that the line is 530? It is illogical as it is a |
And please provide WLED configuration (cfg.json). |
Tracing the changes, this code has not been changed in about 2 years. And only changed |
Line 530 before the for loop I added this to monitor the packetSize: This is the trace:
There is an underflow when packetSize == 2 line 530 in Moreover I'm under the impression that Here is the wled_cfg.json |
Indeed the part "packetsize -3" may underflow, as everything is computed as unsigned, and "2U - 3U = UINT32_MAX". Please add the following right before the "for(" line: |
Yes I made the modification and the crash is gone. |
when only two bytes were received in a packet, the "for" condition `packetsize -3` would underflow, leading to an infinite loop.
The problem is |
There may be a bug in there as 2-byte packet only contains header and timeout seconds. No LED data. |
I was not sure if other formats (drgb) allow for 2-bytes packets. What is the minimal size for a "correct" UDP realtime packet? |
Yes, you are correct. on more thorough inspection there are other possible valid packets <5. |
warls: 6 byte minimum that is assuming at least 1 LED data is present |
perhaps the easiest solution is to change |
May work, but i'm not 100% sure how gcc will handle the resulting comparison between signed and unsigned. Another question is, why did WLED receive short packages? Could it be fragmentation of large network packets? Or just a coding bug in the tool that sends the data? |
Same crash with HyperHDR 20 as it also uses the reactive API now. Will try with final Release 14.1 now. |
The exact case from OP has been resolved in 0.14.1. |
Can't confirm, same crashy behaviour with 0.14.1 using ESP32-Ethernet (on WT32-ETH01) and current HyperHDR master. |
@Xploder please do as OP by providing relevant traces and open a new issue. |
@Xploder it might look similar, however the root cause of the specific crash that was reported by @romain145 is definitely fixed in 0.14.1. Please open a new bug report ("New Issue") for the crash you see with 0.14.1.
|
…oookie#3672) when only two bytes were received in a packet, the "for" condition `packetsize -3` would underflow, leading to an infinite loop.
…oookie#3672) when only two bytes were received in a packet, the "for" condition `packetsize -3` would underflow, leading to an infinite loop.
What happened?
When using audio-reactive-led-strip to send LED data over UDP the ESP32 reboots after about 10sec of streaming with the following message:
Running 75e857a with the following PIO config as suggested here #3637 (comment)
To Reproduce Bug
Run visualisation.py from https://github.com/scottlawsonbc/audio-reactive-led-strip
Update config.py with the correct IP and UDP port.
Expected Behavior
Should run without crashing.
Install Method
Self-Compiled
What version of WLED?
WLED 0.14.1-b3 (build 2401060)
Which microcontroller/board are you seeing the problem on?
ESP32
Relevant log/trace output
No response
Anything else?
May be related to #3637
Code of Conduct
The text was updated successfully, but these errors were encountered: