-
Notifications
You must be signed in to change notification settings - Fork 758
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
PyBuffer::get leads to memory corruption under PyPy #1736
Labels
Comments
I can reproduce this on x86_64 macOS with pypy3.7 ❯ ./repro.sh
run number 1
python(98724,0x11530fe00) malloc: Incorrect checksum for freed object 0x7ff6e6604138: probably modified after being freed.
Corrupt value: 0x1
python(98724,0x11530fe00) malloc: *** set a breakpoint in malloc_error_break to debug
./repro.sh: line 9: 98724 Abort trap: 6 python ./test.py lldb backtrace
|
Nice repro, that's really useful. I think I've found the issue, see #1737 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've put up a repository containing a minimal repro of this bug: https://github.com/oconnor663/pyo3_pybuffer_repro. You can run the
repro.sh
script there to execute all the repro steps below.I'm on x86-64 Arch Linux, with CPython 3.9.6, PyPy 7.3.5, and Rust 1.53.0. Here is a minimal Rust extension demonstrating this bug:
Cargo.toml:
src/lib.rs:
test.py:
I create a
virtualenv -p pypy3
, and inside that virtualenv I build and install with extension module withmaturin develop
. (Note that this relies on the fix at PyO3/maturin#596, which only just shipped in v0.11.2.) Finally I executetest.py
over and over in a loop something like this in Bash (wherepython
refers to the virtualenv Python interpreter):Here's an example run of
repro.sh
(which executes all the steps above) on my box:Note that the assert in
test.py
did pass a few times before the crash in this case. On some runs it crashes immediately for me, and on others it gets through a handful of executions before crashing like it did here.If I replace
virtualenv -p pypy3
withvirtualenv -p /usr/bin/python
(CPython 3.9.6),test.py
always succeeds and that while loop runs forever.The text was updated successfully, but these errors were encountered: