Bug 2303832

Summary: python-greenlet: segmentation fault with python 3.13
Product: [Fedora] Fedora Reporter: Sergio Correia <scorreia>
Component: python-greenletAssignee: Nils Philippsen <nphilipp>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: rawhideCC: apevec, igor.raits, kevin, ksrot, mbayer, michel, nphilipp, scorreia, terjeros
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-greenlet-3.0.3-7.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-11 06:13:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2302520    

Description Sergio Correia 2024-08-09 09:40:46 UTC
While testing in rawhide and python 3.13rc1, we encountered a segfault when running some python-greenlet tests.

As this behavior started with 3.13rc1 (no issues with the previous 3.13 beta, 3.13.0b4), it seemed at first a regression in (c)python, and I opened the following upstream issue to try to get more information: https://github.com/python/cpython/issues/122772

It's not clear (to me) where the actual problem lies, but I just noticed that a "simple" rebuild of python-greenlet in rawhide seems to "fix" the issue, so I am opening this issue here.

The reproducer used is the test_oops.py file, which has the following content:


import unittest
from contextvars import copy_context
from greenlet import getcurrent, greenlet

class Oops_test(unittest.TestCase):
    def test_oops(self):
        let = greenlet(copy_context().run)
        let.switch(getcurrent().switch)

Reproducible: Sometimes

Steps to Reproduce:
1. Install python greenlet: "dnf install python-greenlet"
2. Make sure to have the test_oops.py reproducer file (its content is availble in the "Details" section)
3. Run the test: "python3 -m unittest test_oops" 

Note that it does not crash every single time, so you may have to run step #3 a couple of times before it actually crashes. In here, it doesn't really take long to do so.
Actual Results:  
python3 -m unittest test_oops
Segmentation fault (core dumped)

Expected Results:  
python3 -m unittest test_oops
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

As mentioned in the details section, a rebuild of python-greenlet component appears to "resolve" the issue.

The version where the issue was encountered is python3-greenlet-3.0.3-6.fc41.x86_64

Comment 1 Nils Philippsen 2024-08-10 09:43:26 UTC
(In reply to Sergio Correia from comment #0)
> While testing in rawhide and python 3.13rc1, we encountered a segfault when
> running some python-greenlet tests.
> 
> As this behavior started with 3.13rc1 (no issues with the previous 3.13
> beta, 3.13.0b4), it seemed at first a regression in (c)python, and I opened
> the following upstream issue to try to get more information:
> https://github.com/python/cpython/issues/122772
> 
> It's not clear (to me) where the actual problem lies, but I just noticed
> that a "simple" rebuild of python-greenlet in rawhide seems to "fix" the
> issue, so I am opening this issue here.

Maybe an issue with one of the pre-RC header files. I’ve verified with a local rebuild that it fixes your reproducer, as well as building python-sqlalchemy, so I’ll kick off a rebuild of greenlet against RC1.