Fix segfaults caused by modifying existing shared library#295
Merged
davidhewitt merged 5 commits intoPyO3:mainfrom Oct 4, 2022
Merged
Fix segfaults caused by modifying existing shared library#295davidhewitt merged 5 commits intoPyO3:mainfrom
davidhewitt merged 5 commits intoPyO3:mainfrom
Conversation
When the built shared library is copied to the correct location, it actually *modifies* any existing shared library, which causes any running process using it to segfault. To fix this, we first delete any existing shared library (which is safe to do) and then copy the newly built shared library to the correct location as a new file. Related to PyO3#257
erikjohnston
commented
Sep 29, 2022
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
adamreichold
approved these changes
Sep 29, 2022
Contributor
Author
|
Thank you for the review! ❤️ |
davidhewitt
reviewed
Sep 29, 2022
Member
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, logic looks good to me, could you just add a CHANGELOG entry please? Then let's merge 👍
Contributor
Author
|
I've added some words to the changelog, though I don't think I really expressed it well. |
davidhewitt
approved these changes
Oct 4, 2022
Member
davidhewitt
left a comment
There was a problem hiding this comment.
That's great as-is - thanks! 👍
|
@davidhewitt: any chance of a release to include this change? It caused a significant outage for us today :(. |
Member
|
Sorry for the delay on release here. I'll try to put live tomorrow. |
Member
|
See #331 |
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Apr 30, 2023
## 1.6.0 (2023-04-27) ### Changed - Prefer passing `--crate-type` option to cargo if "toolchain >= 1.64". [#322](PyO3/setuptools-rust#322) ### Fixed - Fix a bug where rebuilding the library would cause any running processes using it to segfault. [#295](PyO3/setuptools-rust#295) - Fix `setup.cfg` format for compatibility with "poetry==1.4.0". [#319](PyO3/setuptools-rust#319)
Contributor
Author
|
Thank you! ❤️ |
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.
When the built shared library is copied to the correct location, it actually modifies any existing shared library, which causes any running process using it to segfault.
To fix this, we first delete any existing shared library (which is safe to do) and then copy the newly built shared library to the correct location as a new file.
Related to #257
At least, this is the behaviour on Linux, I'm not sure about other OSes.