Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.3k
tools/pyboard.py: Port recent patchs from mpremote serial transport, to add timeouts for non-responsive serial ports#17330
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
Code size report:
|
codecovbot commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #17330 +/- ##======================================= Coverage 98.54% 98.54% ======================================= Files 169 169 Lines 21898 21898 ======================================= Hits 21579 21579 Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
hmaerki commentedMay 26, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I reviewed this PR and it looks fine. I would propose to merge this PR! |
hmaerki commentedMay 27, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
However, there is still a situation where the test time out with a
The problem was most probably that python multiprocessing terminated the processed and unpowered the tentacle. However, the terminating process still could see the powerdown and this is the ioctl error we see in above logs. This behaviour was fixed inoctoprobe/testbed_micropython@02ce3a6.
The second link might be related to this PR: The test was hanging without even executing one test. |
This command still timeouts after 90s as pyboard hangs somehow. |
I was unable to reproduce that error, even with exactly the same hardware (I think?) and using the Anyway, I could force a similar error by making the board lock up during a test run. That lead to a lock-up during This is not really an issue we can fix, because it's the OS that is blocking, waiting for the USB serial port to respond, and it never does respond. |
@hmaerki I tried to trigger a run of this PR, but failed:https://reports.octoprobe.org/github_testbed_micropython_15 Can you please test this PR out (now with the added |
I started this job#16 for you:https://github.com/octoprobe/testbed_micropython/actions/runs/15342563400 |
Thanks for triggering the new run. It seems to have worked, output is here:https://reports.octoprobe.org/github_selfhosted_testrun_16 It shows that the problem with test timeout is now resolved:
In summary:
|
hmaerki commentedJun 2, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Started another batchhttps://reports.octoprobe.org/github_selfhosted_testrun_18 and got timeouts:https://reports.octoprobe.org/github_selfhosted_testrun_18/RUN-TESTS_STANDARD_NATIVE@2731-RPI_PICO2-RISCV/basics_0prelim.py.out Intersting observation: Inhttps://reports.octoprobe.org/github_selfhosted_testrun_18/RUN-TESTS_STANDARD_VIA_MPY@2731-RPI_PICO2-RISCV/testresults.txt
From now on, all tests fail! It is probably the RPI_PICO2-RISCV which locks up! Run WITHOUT multiprocessing (results not stored):
In both cases, only @dpgeorge: To me, this MR is resolved as pyboard does always recover from timeout! Please merge into master. |
Yes, I have seen this happen with this PR, if the device locks up then all tests from then on fail. That's an improvement though! Previously |
This applies the mpremote commit0d46e45to pyboard.py.If the target does not return any data then `read_until()` will blockindefinitely. Fix this by making the initial read part of the general readlook, which always checks `inWaiting() > 0` before reading from the serialdevice.Also added the UART timeout to the constructor. This is not currently usedbut may be used as an additional safeguard.Signed-off-by: Damien George <damien@micropython.org>
This applies the mpremote commit03fe9c5to pyboard.py.The `timeout_overall` is used in `enter_raw_repl()`. It prevents waitingforever for a serial device that does not respond to the Ctrl-C/Ctrl-D/etccommands and is constantly outputting data.Signed-off-by: Damien George <damien@micropython.org>
If the USB serial device locks up, then writes to that device can hangforever. That can make the test runner `tests/run-tests.py` lock up, amongother problems.This commit introduces a 5 second write-timeout, and catches any OSError'sraised during `enter_raw_repl()`. Now, if a USB serial device locks up,`enter_raw_repl()` will eventually raise an exception.Signed-off-by: Damien George <damien@micropython.org>
3b66b8c
todea3035
Comparedea3035
intomicropython:masterUh oh!
There was an error while loading.Please reload this page.
Summary
This applies#16513 and#16616 (made for mpremote) to
tools/pyboard.py
. They add timeouts to the initial connection phase to a target board, to help with non-responsive serial ports. Without these patchespyboard.py
can hang indefinitely waiting for a board to respond.Testing
To be tested by@hmaerki on Octoprobe.
Trade-offs and Alternatives
The test runners still use
pyboard.py
. Eventually it would be good to change them to usempremote
as the backend, but that's a lot more effort.