Skip to content

Conversation

Yi-sir
Copy link

@Yi-sir Yi-sir commented Nov 25, 2024

#127213

As mentioned in this issue, a child process created by multiprocessing.Process() with method 'fork' works not the same as os.fork() or c fork() on unloading of .so files.

replace os._exit() to sys.exit() to fix it.

@ghost
Copy link

ghost commented Nov 25, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Nov 25, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@Yi-sir Yi-sir changed the title gn-127213: Replace os._exit() to sys.exit(), so that .so will alos be unloaded in child process gh-127213: Replace os._exit() to sys.exit(), so that .so will alos be unloaded in child process Nov 25, 2024
@Yi-sir Yi-sir changed the title gh-127213: Replace os._exit() to sys.exit(), so that .so will alos be unloaded in child process [3.11]gh-127213: Replace os._exit() to sys.exit(), so that .so will alos be unloaded in child process Nov 25, 2024
@oskar-skog
Copy link

I believe os._exit is the intended behaviour here.

sys.exit will raise a SystemExit that may be caught in code that is only expected to run in the parent.

@Yi-sir
Copy link
Author

Yi-sir commented Nov 26, 2024

I believe os._exit is the intended behaviour here.

sys.exit will raise a SystemExit that may be caught in code that is only expected to run in the parent.

But os._exit() will not unload .so in child process, which would cause some error.

@ZeroIntensity
Copy link
Member

Sorry, 3.11 doesn't take bugfixes anymore. I'm closing this because trying to switch the target branch to main will be a headache, and we might accidentially trigger a codeowner review from half the core team (that tends to happen when switching the target branch). Please fix the issue for the main branch, and then open a new PR, we'll deal with backporting this to 3.13 and 3.12 automatically after it lands on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants