Skip to content

Fix DockerExecutor connection reset error with server readiness check - #1684

Merged
albertvillanova merged 9 commits into
huggingface:mainfrom
benoriol:fix-jupyter-start
Sep 1, 2025
Merged

albertvillanova merged 9 commits into
huggingface:mainfrom
benoriol:fix-jupyter-start

Conversation

@benoriol

Copy link
Copy Markdown
Contributor

Issue: Trying to send request to jupyter API before the process is ready - gives error occasionally.

Solution: Wait until the jupyter API shows ok health status before continuing.

@albertvillanova albertvillanova left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot for the fix: this was really necessary!!

Note that the root cause was that while the Docker container reported as "running", the Jupyter Kernel Gateway service inside the container needed additional time to fully initialize and be ready to accept connections. This PR adds proper server readiness checks and retry logic to ensure the Jupyter Kernel Gateway is fully operational before attempting to create kernels and websocket connections.

I just fixed code quality, changed the check endpoint from /api to /api/kernelspecs (to be completely sure kernel-management is operational) and extracted the functionality as a method, so it is aligned with ModalExecutor, and linked the corresponding GH issue.

@albertvillanova albertvillanova changed the title fix: Wait for jupyter start in docker executor Fix DockerExecutor connection reset error with server readiness check Sep 1, 2025
@albertvillanova
albertvillanova merged commit ec1444f into huggingface:main Sep 1, 2025
maxwellfet928 pushed a commit to maxwellfet928/smolagents that referenced this pull request Jun 8, 2026
…huggingface#1684)

Co-authored-by: Ubuntu <ubuntu@ip-172-31-4-23.us-west-2.compute.internal>
Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: DockerExecutor fails to initialize with "Connection reset by peer" error

2 participants