crash when compiled with nuitka #1752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Nuitka apparently produces coroutine objects that don't have an associated frame. This is not in keeping with standard Python behavior, and breaks Trio's KeyboardInterrupt protection mechanism. (In general, producing a fully drop-in Python compiler is extremely challenging; there are many dark corners like this. I wasn't previously familiar with Nuitka but I took a brief look at their documentation and I would expect potentially more points of difference like this.) If you want your Trio app to run faster, you'll probably have better luck running it under PyPy than under Nuitka. |
To be fair, the way trio messes with |
Fortunately Ctrl+C handling isn't a huge priority for this app, so I decided to pursue this further. I changed that line to this:
and then I had to change _core/_ki.py line 124 to this:
then _core/_ki.py line 141 to this:
At this point I'm geting this traceback. I feel I'm in over my head so I'm stopping here, but posting it in case it's useful to someone:
|
Huh. That's a big "cannot ever happen" as Trio never sends So at first glance this looks like a Nuitka bug. |
I have found the Trio (0.19.0, on Windows) works fine in Nuitka (0.6.18) when I disable keyboard interupt handling in Trio. So at least @remdragon's issue has been fixed. To disable keyboard interrupt handling I did two things:
Personally, I don't need Trio's special KI handling anyway. I call Feature request: Could Trio please be given a simple global way to shutdown KI handling? I think it will be straightforward to wrap the above two changes into a Nuitka plugin, which is a bit cleaner than manually patching an installed version of Trio, but it will still be fragile because it would depend on the exact source code in Trio. |
I'm having a very similar issue trying to build an app that uses PySide6 and Trio. I followed the instructions on Qt's site for how to create an async app with trio. The application builds and runs, OK, but when I try to run the main asynchronous entry point, I'm seeing an error that looks like Trio is trying to do something that doesn't work when built with Nuitka. I'm wondering if anyone has seen this and if there's a workaround/fix. Everything works fine running from source. Thanks!
|
@jimkring Did you try the trio plugin for Nuitka that I wrote? It comes with Nuitka so you don't need to install anything, just enable it. I haven't tried it for a while so it's possible it doesn't work with the latest version of Trio. Beware that it disables graceful handing of |
@JamesOldfield that fixed the issue! Thank you very much. |
I got the following crash trying to compile my app with nuitka. I'm guessing this is something they need to fix, but I thought I would share it here in case it helps:
Python 3.8.5
Trio 0.16.0
Quart 0.12.0
Quart-Trio 0.5.1
Nuitka 0.6.9.2
The text was updated successfully, but these errors were encountered: