FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-38707: Fix for multiprocessing.Process MainThread.native_id by jaketesler · Pull Request #17088 · python/cpython · GitHub

Repository navigation

bpo-38707: Fix for multiprocessing.Process MainThread.native_id - #17088

Merged
miss-islington merged 9 commits into
python:masterfrom
jaketesler:fix-mp-native-id
Nov 19, 2019
Merged

miss-islington merged 9 commits into
python:masterfrom
jaketesler:fix-mp-native-id

Conversation

jaketesler commented Nov 8, 2019 •
edited by miss-islington
Loading

Copy link
Copy Markdown
Contributor

This PR implements a fix for multiprocessing.Process objects; the error occurs when Processes are created using either fork or forkserver as the start_method.

In these instances, the MainThread of the newly created Process object retains all attributes from its parent's MainThread object, including the native_id attribute. The resulting behavior is such that the new process' MainThread captures an incorrect/outdated native_id (the parent's instead of its own).

This change forces the Process object to update its native_id attribute during the bootstrap process.

cc @vstinner

https://bugs.python.org/issue38707

Automerge-Triggered-By: @pitrou

brandtbucher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good!

Copy link
Copy Markdown
Contributor Author

Tests passed – ready to merge! @brandtbucher

Copy link
Copy Markdown
Member

CC @pitrou

Copy link
Copy Markdown
Contributor Author

cc @vstinner

pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM except for one minor comment.

Comment thread Lib/test/_test_multiprocessing.py Outdated

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Copy link
Copy Markdown
Contributor Author

I didn't expect the Spanish Inquisition :)

Copy link
Copy Markdown

Nobody expects the Spanish Inquisition!

@pitrou: please review the changes made to this pull request.

bedevere-bot requested a review from pitrou November 14, 2019 01:59

pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

+1

Copy link
Copy Markdown
Contributor

@jaketesler: Status check is done, and it's a success ✅ .

miss-islington merged commit c6b20be into python:master Nov 19, 2019

Copy link
Copy Markdown
Contributor

Thanks @jaketesler for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 19, 2019
…onGH-17088)

This PR implements a fix for `multiprocessing.Process` objects; the error occurs when Processes are created using either `fork` or `forkserver` as the `start_method`.

In these instances, the `MainThread` of the newly created `Process` object retains all attributes from its parent's `MainThread` object, including the `native_id` attribute. The resulting behavior is such that the new process' `MainThread` captures an incorrect/outdated `native_id` (the parent's instead of its own).

This change forces the Process object to update its `native_id` attribute during the bootstrap process.

cc @vstinner

https://bugs.python.org/issue38707

Automerge-Triggered-By: @pitrou
(cherry picked from commit c6b20be)

Co-authored-by: Jake Tesler <jake.tesler@gmail.com>

Copy link
Copy Markdown

GH-17261 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Nov 19, 2019
…7088)

This PR implements a fix for `multiprocessing.Process` objects; the error occurs when Processes are created using either `fork` or `forkserver` as the `start_method`.

In these instances, the `MainThread` of the newly created `Process` object retains all attributes from its parent's `MainThread` object, including the `native_id` attribute. The resulting behavior is such that the new process' `MainThread` captures an incorrect/outdated `native_id` (the parent's instead of its own).

This change forces the Process object to update its `native_id` attribute during the bootstrap process.

cc @vstinner

https://bugs.python.org/issue38707

Automerge-Triggered-By: @pitrou
(cherry picked from commit c6b20be)

Co-authored-by: Jake Tesler <jake.tesler@gmail.com>
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
…onGH-17088)

This PR implements a fix for `multiprocessing.Process` objects; the error occurs when Processes are created using either `fork` or `forkserver` as the `start_method`.

In these instances, the `MainThread` of the newly created `Process` object retains all attributes from its parent's `MainThread` object, including the `native_id` attribute. The resulting behavior is such that the new process' `MainThread` captures an incorrect/outdated `native_id` (the parent's instead of its own). 

This change forces the Process object to update its `native_id` attribute during the bootstrap process.

cc @vstinner





https://bugs.python.org/issue38707



Automerge-Triggered-By: @pitrou
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

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL