commit:     cbe7569ad85f1aaebc9d3718dba218c55f15517c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 25 21:19:27 2025 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct 25 21:36:28 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cbe7569a

ForkProcess: handle ConnectionResetError from send_handle

This fixes cases where AsynchronousLockTestCase caused the pytest
python interpreter to exit with an uninformative "Terminated" error
under python 3.14. I was able to reveal the ConnectionResetError by
running the tests like this:

python -m unittest -v lib/portage/tests/locks/test_asynchronous_lock.py

Bug: https://bugs.gentoo.org/965126
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/tests/locks/test_asynchronous_lock.py | 9 ---------
 lib/portage/util/_async/ForkProcess.py            | 2 +-
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/lib/portage/tests/locks/test_asynchronous_lock.py 
b/lib/portage/tests/locks/test_asynchronous_lock.py
index 59d2fc44e9..da371e7c2c 100644
--- a/lib/portage/tests/locks/test_asynchronous_lock.py
+++ b/lib/portage/tests/locks/test_asynchronous_lock.py
@@ -2,11 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 
 import signal
-import sys
 import tempfile
 
-import pytest
-
 from portage import os
 from portage import shutil
 from portage.tests import TestCase
@@ -126,15 +123,9 @@ class AsynchronousLockTestCase(TestCase):
         finally:
             shutil.rmtree(tempdir)
 
-    @pytest.mark.skipif(
-        sys.version_info >= (3, 14), reason="fails with python 3.14.0a3"
-    )
     def testAsynchronousLockWaitCancel(self):
         self._testAsynchronousLockWaitCancel()
 
-    @pytest.mark.skipif(
-        sys.version_info >= (3, 14), reason="fails with python 3.14.0a3"
-    )
     def testAsynchronousLockWaitCancelHardlink(self):
         prev_state = os.environ.pop("__PORTAGE_TEST_HARDLINK_LOCKS", None)
         os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] = "1"

diff --git a/lib/portage/util/_async/ForkProcess.py 
b/lib/portage/util/_async/ForkProcess.py
index 946978b301..09b4fc9e07 100644
--- a/lib/portage/util/_async/ForkProcess.py
+++ b/lib/portage/util/_async/ForkProcess.py
@@ -162,7 +162,7 @@ class ForkProcess(SpawnProcess):
                     fd,
                     self.pid,
                 )
-        except BrokenPipeError as e:
+        except (BrokenPipeError, ConnectionResetError) as e:
             # This case is triggered by testAsynchronousLockWaitCancel
             # when the test case terminates the child process while
             # this thread is still sending the fd_pipes (bug 923852).

Reply via email to