Resolve capture_output deadlock in multiprocessing environments#3957
Open
jsiirola wants to merge 30 commits into
Open
Resolve capture_output deadlock in multiprocessing environments#3957jsiirola wants to merge 30 commits into
capture_output deadlock in multiprocessing environments#3957jsiirola wants to merge 30 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3957 +/- ##
=======================================
Coverage 90.10% 90.10%
=======================================
Files 909 909
Lines 108525 108541 +16
=======================================
+ Hits 97787 97804 +17
+ Misses 10738 10737 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mrmundt
requested changes
May 19, 2026
Comment on lines
+613
to
+614
| # | ||
| ## if deps.capture_output_lock.locked(): |
Member
Author
There was a problem hiding this comment.
No: that is part of the comment text
mrmundt
approved these changes
May 20, 2026
Contributor
mrmundt
left a comment
There was a problem hiding this comment.
i am fine with this as-is. "Future Us" concern: test_environ could be potentially overly sensitive to internal Python changes, particularly across versions.
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.
Fixes # .
Summary/Motivation:
#3908 pointed out that we could inadvertently trigger a deadlock in multiprocessing environments. This PR attempts to resolve that by switching from a
threading.Lockto amultiprocessing.Lockif multiprocessing is being used in the python process.I am not closing the issue as the original reporters have not confirmed if it actually resolves their use case.
As part of this, I needed to overhaul the import time test / reporting logic so that we can more accurately test import timing for multiprocessing environments.
Changes proposed in this PR:
multiprocessing.Lockwhen multiprocessing is importedpyomo.environLegal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: