-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-125828 : Fix 'get_value' missing for [Bounded]Semaphore on multiprocessing MacOSX - C workaround #130913
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
Draft
YvesDup
wants to merge
17
commits into
python:main
Choose a base branch
from
YvesDup:sem-macosx-multiprocessing-module-C
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,326
−44
Conversation
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.
Following #125829 discussions and after a long deeping in the
_multiprocessing.semaphore.cC file, I suggest a workaround based on a shared memory that contains an array to store all the internal semaphore counters.At the moment, all the tests are passing, but I'm having 2 side problems, the second of which is really embarrassing:
sysconf(SC_SEM_NSEMS_MAX)which is set to 87381 on a mac OSX 15. This is very high.shm_unlinkto properly close the shared memory (First I calledshm_open)?Regarding this last point, I wonder if only the process that opened the shared memory should call this function? Or should all processes that called
shm_opencallshm_unlink? Unfortunately, the Posix documentation isn't precise.I worked on the count of opened/closed processes, with the aim of calling
shm_unlinkwhen the last process has closed, without success. I also had a look to theposixshmemmodule, without success too.Could the
resource_trackerand/or the use of theFinalizeclass of themultiprocessing.utilmodule help me to fix this problem ? Is it possible to use these 2 Python libs from C API ?This memory management difficulty make me think that this choice may not be appropriate. I am a bit stuck.
Thank you for your feedback and ideas.