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

Fix UDPSocket not being closed when VM destructs #18687

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft

Fix UDPSocket not being closed when VM destructs #18687

wants to merge 21 commits into from

Conversation

190n
Copy link
Collaborator

@190n 190n commented Mar 31, 2025

What does this PR do?

Fixes lifetime bugs in the UDPSocket implementation. In particular, the socket would not be closed if the VM exited before it was garbage collected. This means file descriptors would leak if worker threads are rapidly created and open UDP sockets.

TODOs before merging:

  • fix the objects not getting GC'd until VM exits
  • rebase this on main once the branch ben/workers is merged

How did you verify your code works?

TODO (this probably deserves new tests)

@robobun
Copy link

robobun commented Mar 31, 2025

Updated 4:31 PM PT - Mar 31st, 2025

@190n, your commit 2f2b530 has 2 failures in Build #14317:


🧪   try this PR locally:

bunx bun-pr 18687

@190n 190n mentioned this pull request Apr 3, 2025
4 tasks
Base automatically changed from ben/workers to main April 8, 2025 12:29
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.

2 participants