Bug 2327969

Summary: python-tornado fails to build with Python 3.14: RuntimeError: There is no current event loop in thread 'MainThread'.
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-tornadoAssignee: Python Packagers SIG <python-packagers-sig>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aurelien, gwync, ksurma, mail, mhroncok, orion, python-packagers-sig, rcallicotte, tomspur
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: 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-22 09:43:51 UTC
python-tornado fails to build with Python 3.14.0a1.

+ /usr/bin/python3 -m tornado.test
...............................................................sssssssssssssssssssssssssssssssssssssssssss................................s.........................................................................s.........................................................................ss...............................................................................................ss........................Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from tornado.ioloop import IOLoop; classname = lambda x: x.__class__.__name__; from tornado.platform.asyncio import AsyncIOMainLoop; AsyncIOMainLoop().install(); print(classname(IOLoop.current()))
                                                                                                                                         ~~~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/python-tornado-6.4.1-build/tornado-6.4.1/tornado/util.py", line 276, in __new__
    instance.initialize(*args, **init_kwargs)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-tornado-6.4.1-build/tornado-6.4.1/tornado/platform/asyncio.py", line 288, in initialize
    super().initialize(asyncio.get_event_loop(), **kwargs)
                       ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.14/asyncio/events.py", line 681, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
                       % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.
E.......................................................................................................................................................................................................................s....s...s..................................................................................................................................s....................s................s.........s.................s..............................sss.................................................s...........s................ss..........s...................................................................s..........................................................................................................................................s...................................................
======================================================================
ERROR: test_asyncio_main (tornado.test.ioloop_test.TestIOLoopConfiguration.test_asyncio_main)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-tornado-6.4.1-build/tornado-6.4.1/tornado/test/ioloop_test.py", line 789, in test_asyncio_main
    cls = self.run_python(
        "from tornado.platform.asyncio import AsyncIOMainLoop",
        "AsyncIOMainLoop().install()",
        "print(classname(IOLoop.current()))",
    )
  File "/builddir/build/BUILD/python-tornado-6.4.1-build/tornado-6.4.1/tornado/test/ioloop_test.py", line 772, in run_python
    return native_str(subprocess.check_output(args)).strip()
                      ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.14/subprocess.py", line 472, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/usr/lib64/python3.14/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', 'from tornado.ioloop import IOLoop; classname = lambda x: x.__class__.__name__; from tornado.platform.asyncio import AsyncIOMainLoop; AsyncIOMainLoop().install(); print(classname(IOLoop.current()))']' returned non-zero exit status 1.

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/08293008-python-tornado/

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

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 Orion Poplawski 2025-02-17 05:01:45 UTC
WIth 6.4.2 the error is about deprecation warnings.  See upstream https://github.com/tornadoweb/tornado/issues/3458.  It's not immediately obvious how to ignore deprecation warning in tornado's tests, but that seems to be the way that upstream is heading.

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