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

Make Socket hold a reference to its Context #229

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

JamesWrigley
Copy link
Member

This prevents the Context from being garbage collected while the Socket is still alive, otherwise the Socket would be closed by the Context's finalizer while the Socket is potentially still in use.

Fixes #223. The problem is Julia thinking it could delete the Context in spite of the Socket actually needing it. In the function the compiler was probably able to prove it could be GC'd, which is why it was failing in the function but not in the script/REPL.

This prevents the `Context` from being garbage collected while the `Socket` is
still alive, otherwise the `Socket` would be closed by the `Context`'s finalizer
while the `Socket` is potentially still in use.
@JamesWrigley JamesWrigley self-assigned this May 17, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.17%. Comparing base (9ec590e) to head (9767ab3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #229   +/-   ##
=======================================
  Coverage   78.17%   78.17%           
=======================================
  Files           9        9           
  Lines         362      362           
=======================================
  Hits          283      283           
  Misses         79       79           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JamesWrigley
Copy link
Member Author

(if there's no objections, I'd like to merge this by the end of the week)

@stevengj
Copy link
Contributor

LGTM.

@stevengj stevengj merged commit f278afd into master May 20, 2024
6 checks passed
@stevengj stevengj deleted the socket-ctx-ref branch May 20, 2024 18:31
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.

Basics Publisher Example Crashes
3 participants