Conversation
b250dcd to
d65f2c9
Compare
3 tasks
) The sync Session methods (open_notebook, create_notebook, join_notebook) were creating a tokio runtime for the connect call, then dropping it before creating the Session. This killed the sync task that was spawned during connect, breaking all subsequent daemon requests (start_kernel, execute_cell, etc.). The fix passes the connect runtime through to the Session instead of dropping it and creating a new one. The sync task stays alive for the lifetime of the Session. Root cause: runtime A spawns sync task → drop(runtime A) cancels task → from_state creates runtime B → DocHandle channels are dead → every send_request gets SyncError::Disconnected. Symptoms: - start_kernel: 'Disconnected from sync task' - Daemon log: 'Streaming load failed: Broken pipe (os error 32)' - Frontend: kernel launch silently fails
441dc47 to
75270ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #992.
The bug
Every
start_kernel()call from the Python bindings failed withRuntimedError: Disconnected from sync task. The daemon log showedBroken pipe (os error 32)during streaming load. The Tauri frontend also couldn't start kernels for saved notebooks.Root cause
The sync
Sessionmethods (open_notebook_with_socket,create_notebook_with_socket,join_notebook_with_socket) all followed this pattern:connect_openspawns a sync task viatokio::spawninsidebuild_and_spawn. That task runs onruntime. Whenruntimeis dropped, the sync task is cancelled.from_statecreates a fresh runtime, but the sync task is gone — theDocHandle's command channels are dead.Why reads worked:
get_cells()reads directly from the local Automerge doc (no sync task needed).Why writes failed:
start_kernel()sendsLaunchKernelthroughDocHandle::send_request()→cmd_tx.send()→ the sync task'scmd_rxis dead →SyncError::Disconnected.Why the daemon saw broken pipe: The sync task owned the socket reader. When the runtime dropped, the socket closed. The daemon's next
send_typed_frame()got EPIPE.Fix
Pass the connect runtime through to the Session instead of dropping it and creating a new one. New method
from_state_with_runtime(runtime, ...)keeps the sync task alive.Verification
Also verified with
open_notebookon a saved.ipynbfile withenv_source='auto'.