Bug 2323184

Summary: python-etcd fails to build with Python 3.14: _pickle.PicklingError: Can't pickle local object <function TestWatch.test_watch_indexed_generator.<locals>.watch_value at 0x7f0d39f71dd0>
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-etcdAssignee: Karolina Surma <ksurma>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, mbarnes, mhroncok, neil
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-22 17:21:23 UTC Type: Bug
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: 2322407    

Description Karolina Surma 2024-11-01 15:02:08 UTC
python-etcd fails to build with Python 3.14.0a1.

____________________ TestWatch.test_watch_indexed_generator ____________________

self = <etcd.tests.integration.test_simple.TestWatch testMethod=test_watch_indexed_generator>

    def test_watch_indexed_generator(self):
        """INTEGRATION: Receive a watch event from other process, ixd, (2)"""
    
        set_result = self.client.set("/test-key", "test-value")
        set_result = self.client.set("/test-key", "test-value0")
        original_index = int(set_result.modifiedIndex)
        set_result = self.client.set("/test-key", "test-value1")
        set_result = self.client.set("/test-key", "test-value2")
    
        queue = multiprocessing.Queue()
    
        def change_value(key, newValue):
            c = etcd.Client(port=6001)
            c.set(key, newValue)
    
        def watch_value(key, index, queue):
            c = etcd.Client(port=6001)
            iterevents = c.eternal_watch(key, index=index)
            for i in range(0, 3):
                queue.put(next(iterevents).value)
    
        proc = multiprocessing.Process(
            target=change_value,
            args=(
                "/test-key",
                "test-value3",
            ),
        )
    
        watcher = multiprocessing.Process(
            target=watch_value, args=("/test-key", original_index, queue)
        )
    
>       watcher.start()

src/etcd/tests/integration/test_simple.py:398: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/multiprocessing/process.py:121: in start
    self._popen = self._Popen(self)
/usr/lib64/python3.14/multiprocessing/context.py:224: in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
/usr/lib64/python3.14/multiprocessing/context.py:300: in _Popen
    return Popen(process_obj)
/usr/lib64/python3.14/multiprocessing/popen_forkserver.py:35: in __init__
    super().__init__(process_obj)
/usr/lib64/python3.14/multiprocessing/popen_fork.py:20: in __init__
    self._launch(process_obj)
/usr/lib64/python3.14/multiprocessing/popen_forkserver.py:47: in _launch
    reduction.dump(process_obj, buf)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <Process name='Process-8' parent=229 initial>
file = <_io.BytesIO object at 0x7f0d39e66ac0>, protocol = None

    def dump(obj, file, protocol=None):
        '''Replacement for pickle.dump() using ForkingPickler.'''
>       ForkingPickler(file, protocol).dump(obj)
E       _pickle.PicklingError: Can't pickle local object <function TestWatch.test_watch_indexed_generator.<locals>.watch_value at 0x7f0d39f71dd0>
E       when serializing dict item '_target'
E       when serializing multiprocessing.context.Process state
E       when serializing multiprocessing.context.Process object

/usr/lib64/python3.14/multiprocessing/reduction.py:60: PicklingError

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08198518-python-etcd/

For all our attempts to build python-etcd with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-etcd/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Karolina Surma 2024-11-18 09:19:23 UTC
Per https://docs.python.org/dev/whatsnew/3.14.html#multiprocessing:

The default start method (see Contexts and start methods) changed from fork to forkserver on platforms other than macOS & Windows where it was already spawn. If you require the threading incompatible fork start method you must explicitly request it using a context from multiprocessing.get_context() (preferred) or change the default via multiprocessing.set_start_method(). (Contributed by Gregory P. Smith in gh-84559.)

Comment 2 Aoife Moloney 2025-02-26 13:14:27 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 3 Karolina Surma 2025-04-24 07:43:06 UTC
This blocks samba which blocks freeipa-server-trust-ad which blocks Fedora server critpath, hence raising severity. I'm going to take a look at fixing this.