Description
Describe the problem
If the Arduino board prints a large amount of data without a line break to Serial Monitor, the IDE becomes unresponsive.
To reproduce
Equipment
- Any Arduino board
Steps
- Upload the following sketch to the Arduino board:
void setup() { Serial.begin(115200); } void loop() { Serial.print("hello"); }
- Open the "Serial Monitor" view.
- Select "115200 baud" from the dropdown baud rate menu at the top right corner of the "Serial Monitor" view.
- Wait a couple minutes.
ⓘ It will likely occur much sooner than that, especially with a board that has native USB capability - Try to use the Arduino IDE UI.
🐛 The UI is unresponsive.
Expected behavior
Arduino IDE handles this condition gracefully.
That could even be a limit on the line length that will be displayed, since it is more likely that problematic line lengths would be caused by a missing line break in the sketch than intentionally formatting.
Arduino IDE version
Original report
2.0.0-rc5-snapshot-c9b498f
Last verified with
2.0.0-rc5-snapshot-df8658e (was not fixed by #982)
Operating system
Windows
Operating system version
10
Additional context
There were similar reports of Serial Monitor impact on CPU performance, but those were resolved by #524
- Fast Serial Port reading makes the IDE cpu usage really high and crashes after some time #397
- Serial Monitor lags behind and uses a lot of CPU #519
Additional reports
- Serial Monitor: IDE becomes nearly unusable with really long lines. #2459
- https://forum.arduino.cc/t/2-0-slows-down-if-very-long-lines-but-ok-with-crs-line-feeds-inserted/1021335
- https://forum.arduino.cc/t/ide-2-ver-2-1-wont-close-in-win10/1118105
- https://forum.arduino.cc/t/arduinos-breakdown/1264490
Workaround
Adjust your sketch code so that it will produce line breaks as appropriate to avoid the output of excessively long lines.
For the sketch in the demo above, this would be accomplished by changing the Serial.print
call to Serial.println
:
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("hello");
}
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details