<#1346 fix: don't crash when devbox unpause loses ...
# flyte-github
a
#1346 fix: don't crash when devbox unpause loses the paused-state race (FLYTE-SDK-6W) Pull request opened by EngHabu Why FLYTE-SDK-6W (2 events, on the latest release 2.5.15):
Copy code
CalledProcessError: Command '['docker', 'unpause', 'flyte-devbox']' returned non-zero exit status 1.
  flyte/cli/_devbox.py in launch_devbox
with docker's stderr from the captured event:
Copy code
Error response from daemon: Cannot unpause container 06fcfce7dc99...:
OCI runtime resume failed: container not paused
launch_devbox
checks
docker ps --filter status=paused
and then runs
docker unpause
as two separate docker calls. If the container leaves the paused state in between — a concurrent
docker unpause
, a daemon restart, the container exiting — docker fails with "container not paused" and the
check=True
call raises a raw
CalledProcessError
out of a function wrapped in
@_sentry.capture_errors
. A local docker state race got reported as an SDK crash. Every other docker invocation in this module already goes through
_run_docker()
, which turns failures into a user-facing
click.ClickException
(filtered from Sentry by
_is_user_error
).
pause
and
unpause
were the two calls that were missed when that helper was introduced. What • New `_resume_container()`: treats
not paused
in docker's output as a lost race and returns
False
, so
launch_devbox
falls through to the normal running/start path instead of crashing. Any other unpause failure becomes a
ClickException
carrying docker's stderr. •
stop_devbox
routes
docker pause
through the existing
_run_docker
helper. Tests 5 new tests in
tests/cli/test_devbox.py::TestPauseResume
— unpause success, the "container not paused" race (reproducing the exact stderr from the Sentry event), a non-race unpause failure,
launch_devbox
falling through to a fresh start when the race is lost, and
stop_devbox
surfacing a pause failure as a
ClickException
. All 5 verified to fail on
main
without the source change; 24/24 pass with it. fixes FLYTE-SDK-6W flyteorg/flyte-sdk