Close nautilus internal pools to silence shutdown AttributeError#1223
Merged
Close nautilus internal pools to silence shutdown AttributeError#1223
Conversation
Nautilus creates its own multiprocessing.Pool instances (pool_l, pool_s)
internally when pool=N. Previously these were never closed, so their
finalizers fired at interpreter shutdown — after the pickle module had
been torn down — producing a cosmetic but noisy:
Exception ignored in: <function Pool.__del__ at 0x...>
AttributeError: 'NoneType' object has no attribute 'dumps'
Close and join the pools once call_search has returned (after the last
iteration, where output_search_internal would otherwise need them alive).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Nautilus's
fit_multiprocessingpassespool=Ntonautilus.Sampler(...), which then creates twomultiprocessing.Poolobjects (pool_l,pool_s) internally. PyAutoFit never closed them, so their finalizers fired at Python interpreter shutdown — afterpicklehad already been torn down — producing:The fit itself is correct, but the stderr noise makes smoke-test output look like a failure and trips log-scraping heuristics. This PR closes + joins the two pools after
call_searchreturns.API Changes
None — internal cleanup only.
See full details below.
Test Plan
pytest test_autofit/non_linear/— 239 passedpython scripts/searches/nest/Nautilus.pyin autofit_workspace under smoke-test env vars — completes with exit 0 and noException ignored/Pool.__del__/AttributeErrorin the logFull API Changes (for automation & release notes)
Removed
Added
Changed Behaviour
autofit.non_linear.search.nest.nautilus.Nautilus.fit_multiprocessing— now closes and joinssearch_internal.pool_landsearch_internal.pool_sbefore returning, and nulls those attributes. Observable effect: the teardownAttributeErrorat interpreter shutdown is gone. No change to the returnedsearch_internalsemantics (the pools were never reused after this point).Migration
🤖 Generated with Claude Code