Skip to content

[3.11]gh-127213: Replace os._exit() to sys.exit(), so that .so will alos be unloaded in child process#127246

Closed
Yi-sir wants to merge 2 commits into
python:3.11from
Yi-sir:3.11
Closed

[3.11]gh-127213: Replace os._exit() to sys.exit(), so that .so will alos be unloaded in child process#127246
Yi-sir wants to merge 2 commits into
python:3.11from
Yi-sir:3.11

Conversation

@Yi-sir

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

Copy link
Copy Markdown

#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

ghost commented Nov 25, 2024

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app

bedevere-app Bot commented Nov 25, 2024

Copy link
Copy Markdown

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
Copy Markdown

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

Yi-sir commented Nov 26, 2024

Copy link
Copy Markdown
Author

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
Copy Markdown
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