Bug 2133853 - Downstream-only patch in Python 3: #371 Revert "bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) (GH-28589)"
Summary: Downstream-only patch in Python 3: #371 Revert "bpo-1596321: Fix threading._s...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.13
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Victor Stinner
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2022-10-11 15:19 UTC by Tomas Orsava
Modified: 2024-05-02 19:03 UTC (History)
8 users (show)

Fixed In Version: python3.13-3.13.0~a6-2.fc41
Clone Of:
Environment:
Last Closed: 2024-05-02 19:03:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomas Orsava 2022-10-11 15:19:24 UTC
From python3.11.spec:

# 00371 # c1754d9c2750f89cb702e1b63a99201f5f7cff00
# Revert "bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) (GH-28589)"
#
# This reverts commit 38c67738c64304928c68d5c2bd78bbb01d979b94. It
# introduced regression causing FreeIPA's tests to fail.
#
# For more info see:
# https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31
# https://github.com/GrahamDumpleton/mod_wsgi/issues/730
Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch

Comment 1 Tomas Orsava 2022-10-11 15:20:31 UTC
Previously tracked in BZ#1287556.

Comment 2 Victor Stinner 2022-11-09 13:23:25 UTC
The revert was motivated by a FreeIPA+mod_wsgi failure.

First report of this issue:
https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31#comment-2278745

Lumir then reported the issue to mod_wsgi:
https://github.com/GrahamDumpleton/mod_wsgi/issues/730

mod_wsgi shutdown was modified in version 4.9.1 to better handle Python 3.9 shutdown:
https://modwsgi.readthedocs.io/en/master/release-notes/version-4.9.1.html#features-changed

Fedora 36 provides python3-mod_wsgi version 4.9.0-3.fc36.

Comment 3 Miro Hrončok 2022-11-15 18:09:21 UTC
> Fedora 36 provides python3-mod_wsgi version 4.9.0-3.fc36.

That was not good enough to remove the patch, see bz2100282.

Comment 4 Victor Stinner 2023-10-18 16:55:07 UTC
I tried to reproduce the issue, but so far I failed.

== Step 1: Install FreeIPA and test it without the bug ==

I installed a fresh Fedora 38 VM. I set the hostname to "server.ipa.test" and I added "192.168.122.17 server.ipa.test" to /etc/hosts. The "server.ipa.test" hostname must not be used as localhost in /etc/hosts.

I ran the following commands as root to install FreeIPA:
---
firewall-cmd --add-service=freeipa-ldap --add-service=freeipa-ldaps
firewall-cmd --add-service=freeipa-ldap --add-service=freeipa-ldaps --permanent
dnf install freeipa-server
ipa-server-install
---

I added "vstinner" user. I tested kinit:
---
[vstinner@server ~]$ kinit admin
Password for admin: 
---

It works. I tested a different user:
---
[vstinner@server ~]$ kinit vstinner
Password for vstinner: 
---

It works as well.


On the host, my laptop, I added "server.ipa.test" hostname to /etc/hosts as 127.0.0.1:
---
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 server.ipa.test
---

To test the web interface, I ran the following command to expose VM tcp/443 as tcp/443 local port on the host (my laptop):

   sudo ssh -L 443:localhost:443 vstinner@fedora

I open https://server.ipa.test/ipa/ui/ in Firefox:

* I log in as "admin"
* The UI lists users
* I can see an user details by clicking on an user


== Step 2: try to reproduce the bug ==

To introduce the bug, I built Python manually:
---
wget 'https://www.python.org/ftp/python/3.11.6/Python-3.11.6.tar.xz'
tar -xf Python-3.11.6.tar.xz
cd Python-3.11.6
./configure --prefix /usr --with-platlibdir=lib64 --libdir=/usr/lib64 --enable-shared
make -j8
---

I created a backup of system Python in ~/BACKUP:
---
mkdir ~/BACKUP
cd ~/BACKUP
cp /usr/bin/python3.11 .
cp /lib64/libpython3.11.so.1.0 .
---

I override Python with:
---
SRC=/home/vstinner/Python-3.11.6

# needed to override /usr/bin/python3.11 program
sudo systemctl stop ipa
sudo systemctl stop firewalld

sudo cp $SRC/python /usr/bin/python3.11
sudo cp $SRC/libpython3.11.so.1.0 /lib64/libpython3.11.so.1.0
---

Then I restarted FreeIPA and firewalld:
---
sudo systemctl start ipa
sudo systemctl start firewalld
---

I did again kinit and web UI tests.

Finally, I tried to reproduce the bug with:
---
[vstinner@server ~]$ time sudo systemctl stop ipa

real	0m3.970s
user	0m0.014s
sys	0m0.019s
---

Problem: FreeIPA stops in less than 5 seconds, it does not time out after 90 seconds.

My test is incomplete.

Comment 6 Miro Hrončok 2024-04-10 19:42:04 UTC
For the record, when upgrading python3.13 from 3.13.0a5 to 3.13.0a6, we removed the patch/revert, as it no longer applies at all after https://github.com/python/cpython/commit/33da0e844c922b3dcded75fbb9b7be67cb013a17

We need to monitor the freeipa situation and rework the patch entirely in case it is still needed.

I am setting this to block the PYTHON3.13 tracker, not to forget.

Comment 7 Miro Hrončok 2024-05-02 19:03:28 UTC
Testing with OpenQA + Python 3.13 Copr. It works now without the patch. https://openqa.stg.fedoraproject.org/tests/3847928

It seems that we no longer need the patch.


Note You need to log in before you can comment on or make changes to this bug.