Skip to content
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

Fix segfaults caused by modifying existing shared library #295

Merged
merged 5 commits into from
Oct 4, 2022

Conversation

erikjohnston
Copy link
Contributor

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.

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
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
@erikjohnston
Copy link
Contributor Author

Thank you for the review! ❤️

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks, logic looks good to me, could you just add a CHANGELOG entry please? Then let's merge 👍

@erikjohnston
Copy link
Contributor Author

I've added some words to the changelog, though I don't think I really expressed it well.

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

That's great as-is - thanks! 👍

@richvdh
Copy link

richvdh commented Apr 20, 2023

@davidhewitt: any chance of a release to include this change? It caused a significant outage for us today :(.

@davidhewitt
Copy link
Member

Sorry for the delay on release here. I'll try to put live tomorrow.

@davidhewitt
Copy link
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)
@erikjohnston
Copy link
Contributor Author

Thank you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants