Skip to content

fix mixture of sync/async sockets in IOPubThread - #1275

Merged
Carreau merged 5 commits into
ipython:mainfrom
minrk:sync-sockets-threads
Oct 26, 2024
Merged

fix mixture of sync/async sockets in IOPubThread#1275
Carreau merged 5 commits into
ipython:mainfrom
minrk:sync-sockets-threads

Conversation

@minrk

Copy link
Copy Markdown
Member

all sockets are explicitly sync until/except we are in the coroutines that will await them, whereas there was an ambiguous mixture of sync and async sockets before

  • consistent behavior of send for child pipe and main process sockets
  • avoids unsafe assumption that send is greedy on async sockets
  • avoids potential issues creating async objects in one thread, then using them in another in a different event loop
  • always creates/uses the right types, regardless of input socket
  • address some typing lint

found while working on ipython/ipyparallel#895

all sockets are explicitly sync until/except we are in the coroutines that will await them
- consistent behavior of send for child pipe and main process sockets
- avoids unsafe assumption that send is greedy on async sockets
- avoids potential issues creating async objects in one thread, then using them in another in a different event loop
- always creates/uses the right types, regardless of input socket
- address some typing lint
Comment threadipykernel/iostream.py
instead, keep same context but use `socket_class` kwarg to specify socket classes
shadow context prevents cleanup of untracked sockets via ctx.destroy because it disconnects socket bookkeeping
@minrk
minrkforce-pushed the sync-sockets-threads branch from b1d0ed5 to 64ff5d4CompareOctober 22, 2024 09:33
@minrk

Copy link
Copy Markdown
MemberAuthor

ok, actually all correct now, I think

@Carreau
Carreau merged commit bf10447 into ipython:mainOct 26, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@minrk@davidbrochart@Carreau