Skip to content
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

Debuglink timing out fix #4655

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

matejcik
Copy link
Contributor

No description provided.

@matejcik matejcik added the translations Put this label on a PR to run tests in all languages label Feb 21, 2025
Copy link

github-actions bot commented Feb 21, 2025

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@matejcik matejcik force-pushed the matejcik/debuglink-timing-out branch from ef0638f to 237540f Compare February 24, 2025 11:07
@grdddj grdddj mentioned this pull request Feb 24, 2025
@matejcik matejcik force-pushed the matejcik/debuglink-timing-out branch from 6f67eee to 0f01352 Compare February 24, 2025 14:21
also take the opportunity to switch to new style typing annotations
syntax
...avoiding a problem where, if the timing is unfortunate, the reply may
get lost when a workflow is ending
@matejcik matejcik force-pushed the matejcik/debuglink-timing-out branch 2 times, most recently from 2212550 to 3056b49 Compare February 26, 2025 13:00
@matejcik matejcik marked this pull request as ready for review February 26, 2025 14:08
@matejcik matejcik requested a review from romanz February 26, 2025 14:08
continue
if timeout is not None and time.time() - start > timeout:
raise TransportException("Timeout reading UDP packet")
time.sleep(0.001)
Copy link
Contributor

@romanz romanz Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why do we need time.sleep() here, since the socket has a timeout set too:

self.socket.settimeout(SOCKET_TIMEOUT)

# XXX Due to a bug, the reply may get lost at the end of a workflow.
# We assume that no single input event takes more than 5 seconds to process,
# and give up waiting after that.
self._call(messages.DebugLinkGetState(return_empty_state=True), timeout=5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just to be sure - we raise an exception here, right?
Asking, since IIRC there was a suggestion to ignore the timeout (i.e. to assume the request has been processed by the device), but then I would suggest also logging that there was an ignored timeout.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use an environment variable to set the timeout?
IIUC, it may take the device more than 5 seconds to respond, e.g. when running WipeDevice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translations Put this label on a PR to run tests in all languages
Projects
Status: 🔎 Needs review
Development

Successfully merging this pull request may close these issues.

2 participants