Bug 2367259

Summary: getmail6 fails to build with Python 3.14: multiprocessing: default start method changed from fork to forkserver
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: getmail6Assignee: Dick Marinus <dick>
Status: CLOSED COMPLETED QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dick, ksurma, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-21 17:37:27 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 2025-05-19 13:38:41 UTC
getmail6 fails to build with Python 3.14.0b1.

________________________________ test_imap_full ________________________________
ModuleNotFoundError: No module named 'getmail'

During handling of the above exception, another exception occurred:

    def test_imap_full():
        mock_tcp = MockTCP()
        with tempfile.TemporaryDirectory() as tmpdir:
            sys.argv = ["getmail", "--getmaildir", tmpdir]
            with open(f"{tmpdir}/oldmail-127.0.0.1-{mock_tcp.server.getsockname()[1]}-account_name-INBOX", "w") as f:
                f.write('1/1\x001745765433\n1/2\x001745765433\n')
            with open(f"{tmpdir}/getmailrc", "w") as f:
                f.write(
                    textwrap.dedent(
                        f"""
                        [options]
                        delete = true
    
                        [retriever]
                        type = SimpleIMAPRetriever
                        server = 127.0.0.1
                        port = {mock_tcp.server.getsockname()[1]}
                        username = account_name
                        mailboxes = ALL
                        password_command = ("/usr/bin/echo", "my_mail_password")
    
                        [destination]
                        type = MDA_external
                        path = /bin/true
    
                        [filter]
                        type = Filter_external
                        path = /bin/cat
                        """
                    )
                )
            p = multiprocessing.Process(target=get_getmail().main, args=())
>           p.start()

test/test_mock_servers.py:406: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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-13' parent=519 initial>
file = <_io.BytesIO object at 0x7f72a5909bc0>, 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 <function main at 0x7f72a56b9220>: No module named 'getmail'
E       when serializing dict item '_target'
E       when serializing multiprocessing.context.Process state
E       when serializing multiprocessing.context.Process object


According to https://docs.python.org/dev/whatsnew/3.14.html#whatsnew314-multiprocessing-start-method

The default start method changed from fork to forkserver on platforms other than macOS and Windows where it was already spawn.
If the threading incompatible fork method is required, you must explicitly request it via a context from multiprocessing.get_context() (preferred) or change the default via multiprocessing.set_start_method().

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

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

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-b1/

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 Dick Marinus 2025-05-19 17:50:28 UTC
Oh that's good to know, thanks for your investigation!

I've written the tests and the importlib is a dirty hack; I suspect this is broken with Python 3.14

I can reproduce and will fix this.

Comment 2 Dick Marinus 2025-05-20 19:10:40 UTC
Should be fixed by https://src.fedoraproject.org/rpms/getmail6/pull-request/2

Comment 3 Dick Marinus 2025-05-21 17:37:27 UTC
Fixed in https://bodhi.fedoraproject.org/updates/FEDORA-2025-3087cfff80