Close uv_idle handles when we're done with them #39268
Merged
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.
uv_idle handles are a bit dangerous because they essentially prevent
the uv loop from going to sleep, so if there's no work to be done
on the julia side, it just turns into a busy loop. We start such
an idle callback in the threads.jl test. We make sure it goes out
of scope, so the GC will eventually close it, but in the meantime
they keep the loop spinning. Now, unfortunately, the next test in
line is the Distributed test, which runs everything in a subprocess,
so it never builds up enough memory pressure to actually run the
GC, so the idle handles never get closed. This isn't too big a
deal, as the worst thing that happens is that it hogs one CPU
core on CI while the threads test is running, but we don't have
enough parallelism there anyway, so I don't expect a meaningful
impact on CI. It does however blow up our rr traces and apparently
causes significantly problems when trying to replay them on pernosco.
This is easy to fix by just closing these handles once we're done
with them.
Reported by @rocallahan