You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
segfault on main for "./python.exe -m blurb" #109198
Sorry, I fell asleep before my bisect script found bad commit 😄
@markshannon Linux machine 5.10.0-25-amd64 #1 SMP Debian 5.10.191-1 (2023-08-16) x86_64 GNU/Linux gcc (Debian 10.2.1-6) 10.2.1 20210110
Python was configured with --with-pydebug. owner is 0xffffffff.
If it doesn't fail with pip invoked as module with -m, try importing pip._internal or pip._internal.utils - this is where it fails on my installation, according to backtrace.
UPD:
My pip version is 23.1.2 Upgrading pip to 23.2.1 through ./python -m ensurepip -U made issue go away.
I failed to reproduce the issue on Windows, Linux, FreeBSD.
I built Python in debug mode ./configure --with-pydebug (and ``-d` option on Windows). I created a venv, downgrade pip to 23.1.2, run Python and import pip._internal.utils: no crash. I installed blurb in the venv and ran "env/bin/python -m blurb": no crash.
@iritkatriel: Can you try to remove blurb .pyc files (maybe create a copy of the blurb/ directory before, to reproduce the bug later if needed)? Does it fix your issue?
The commit 0858328 changes most bytecodes. For example, RETURN_GENERATOR was 48 before and became 48 with this change. Old PYC files are now likely to crash Python.
In the script before, ./python -m ensurepip compiles .py files to .pyc files with the old Python:
The relationship between the code and the crash was not obvious at all :-( Thanks @iritkatriel and @chgnrdv for the reproducers, it was really helpful! I'm glad that this issue is now fixed.
Reacted by Erlend E. Aasland, Hugo van Kemenade and chgnrdv
Activity
iritkatriel commentedon Sep 9, 2023
chgnrdv commentedon Sep 9, 2023
On my Debian attempt to install
blurbsegfaulted. More specifically, it happens when I try to importpipmodule.Backtrace:
vstinner commentedon Sep 9, 2023
You may try git bisect to see when the regression was introduced.
iritkatriel commentedon Sep 10, 2023
iritkatriel commentedon Sep 10, 2023
CC @markshannon
markshannon commentedon Sep 10, 2023
I cannot reproduce on WSL, Intel x86-64.
What platform (including hardware and compiler) does this fail on, and how was Python configured?
What is the value of
ownerandtp? (it looks liketpdoes not point to a validPyTypeObject)iritkatriel commentedon Sep 10, 2023
MacOs Ventura. 2.6 GHz 6-Core Intel Core i7. Totally standard macOS debug configuration.
iritkatriel commentedon Sep 10, 2023
chgnrdv commentedon Sep 10, 2023
Sorry, I fell asleep before my bisect script found bad commit 😄
@markshannon
Linux machine 5.10.0-25-amd64 #1 SMP Debian 5.10.191-1 (2023-08-16) x86_64 GNU/Linuxgcc (Debian 10.2.1-6) 10.2.1 20210110Python was configured with
--with-pydebug.owneris0xffffffff.If it doesn't fail with
pipinvoked as module with-m, try importingpip._internalorpip._internal.utils- this is where it fails on my installation, according to backtrace.UPD:
My
pipversion is23.1.2Upgradingpipto23.2.1through./python -m ensurepip -Umade issue go away.hugovk commentedon Sep 10, 2023
I'm on macOS Ventura 13.5.2 with Apple M2 chip.
vstinner commentedon Sep 10, 2023
I failed to reproduce the issue on Windows, Linux, FreeBSD.
I built Python in debug mode
./configure --with-pydebug(and ``-d` option on Windows). I created a venv, downgrade pip to 23.1.2, run Python and import pip._internal.utils: no crash. I installed blurb in the venv and ran "env/bin/python -m blurb": no crash.chgnrdv commentedon Sep 11, 2023
After upgrading
pipto 23.2.1 and downgrading back to 23.1.2 I wasn't able to reproduce the issue.Steps to trigger issue [again] that worked on my machine:
pipif previously installed (I usedrm -rf ~/.local/lib/python3.13/site-packages/pip*)./python -m ensurepipgit checkout main./python -m pipvstinner commentedon Sep 11, 2023
Oh ok, with these commands, I can now trigger the crash on Linux!
I converted your instructions to a script:
I tried to copy
~/.local/lib/python3.13/site-packages/pip/in the Python directory, but if I do that, the bug goes away!vstinner commentedon Sep 11, 2023
If I remove
.pycfiles from~/.local/lib/python3.13/site-packages/pip/, the bug goes away.@markshannon: Maybe you just forgot to increase the importlib MAGIC number to invalidate old PYC files?
vstinner commentedon Sep 11, 2023
@iritkatriel: Can you try to remove blurb
.pycfiles (maybe create a copy of the blurb/ directory before, to reproduce the bug later if needed)? Does it fix your issue?vstinner commentedon Sep 11, 2023
The commit 0858328 changes most bytecodes. For example, RETURN_GENERATOR was 48 before and became 48 with this change. Old PYC files are now likely to crash Python.
In the script before,
./python -m ensurepipcompiles.pyfiles to.pycfiles with the old Python:Fix for this bug:
vstinner commentedon Sep 11, 2023
I wrote PR #109247 to fix this issue.
vstinner commentedon Sep 11, 2023
Fixed by commit 3b2ecbc.
vstinner commentedon Sep 11, 2023
The relationship between the code and the crash was not obvious at all :-( Thanks @iritkatriel and @chgnrdv for the reproducers, it was really helpful! I'm glad that this issue is now fixed.
erlend-aasland commentedon Sep 11, 2023
Good sleuthing, Victor!
vstinner commentedon Sep 11, 2023
Well, @iritkatriel and @chgnrdv did the hard part, work on a reproducer.