-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-38377: multiprocessing.SemLock requires working /dev/shm on Linux. #19073
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me
Skip test_get_event_loop_new_process on systems which don’t provide it (e.g., building environments of some Linux distributions).
Instead of doing things automagically, add new environmental variable PYTHON_NO_DEV_SHM, which switches off particular tests.
@mcepl: Status check is done, and it's a failure ❌ . |
@mcepl You should have pulled from the updated PR instead of force-pushing :-( |
Please reapply the lost changes now. |
What lost changes? I have rebased my branch on the top of the current master and add one more commit. What did I loose? The change is still the same. I am sorry, what I am missing here? |
Yes, you rebased and force-pushed while I had pushed another commit, so you lost it. |
See 8fd3d0c |
Did you consider to implement auto-detection of SHM interface instead of an env var? Something like
|
@@ -2671,7 +2671,8 @@ def tearDown(self): | |||
asyncio.get_event_loop = self.get_event_loop_saved | |||
|
|||
if sys.platform != 'win32': | |||
|
|||
@unittest.skipIf(os.environ.get('PYTHON_NO_DEV_SHM') == '1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit-pick, you should also check sys.flags.ignore_environment
here.
@tiran Isn’t this exact opposite of what Victor asked for in #19073 (comment) ? |
Ah, I didn't see the comments because they were not on BPO and GH hides coments of closed discussions. |
My first remark was:
That would avoid hardcoding and so it sounds like a reasonable approach. I also wrote:
If code is written, I suggest to add a private function to To come back to https://bugs.python.org/issue38377 it seems like the problem is that creating _multiprocessing.SemLock() raises an OSError. There are other tests which are skipped if SemLock doesn't work. Example with test_concurrent_futures:
Maybe multiprocessing.synchronize should raises an exception on import on Linux if /dev/shm, rather than trying to put logic far from the code? The simplest check is to create a SemLock() object and destroy it. But maybe a different approach which doesn't avoid creating a lock can be found? Another simple check is to raise an ImportError on Linux if /dev/shm/ directory doesn't exist. /dev/shm path is already hardcoded in Lib/multiprocessing/heap.py: Arena._dir_candidates. |
I wrote a different approach: PR #20944 attempts to create a lock and convert OSError to unittest.SkipTest exception. |
Closing this in preference to #20944. |
Skip test_get_event_loop_new_process on systems which don’t provide it
(e.g., building environments of some Linux distributions).
https://bugs.python.org/issue38377
Automerge-Triggered-By: @pitrou