-
Notifications
You must be signed in to change notification settings - Fork 55
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
Intermittent end-of-process segfault on Linux + PySide 6 #1211
Comments
I've also tested against the #1203 branch, with similar results. |
Prompted by a question from @corranwebster: after replacing |
After several rounds of reductions, the crasher example looks like this. There's very little interesting machinery left. The unittest wrapper shouldn't be necessary to reproduce, but on my machine it seems to increase the probability of a segfault, so it's helpful to keep it around while trying to find a minimal crasher. Run under unittest (or coverage) with import unittest
from pyface.gui import GUI
from pyface.qt import QtGui
class MyWindow:
def __init__(self):
self.control = None
def open(self):
if self.control is None:
control = QtGui.QMainWindow()
control.setEnabled(True)
control.setVisible(True)
self.control = control
def close(self):
if self.control is not None:
control = self.control
self.control = None
control.deleteLater()
control.close()
control.hide()
class MyApplication:
def __init__(self):
self.window = None
def run(self):
gui = GUI()
window = MyWindow()
window.open()
self.window = window
gui.invoke_later(self.exit)
gui.start_event_loop()
def exit(self):
window = self.window
self.window = None
window.close()
class TestApplication(unittest.TestCase):
def test_lifecycle(self):
app = MyApplication()
app.run()
# Run the event loop
gui = GUI()
gui.invoke_after(100, gui.stop_event_loop)
gui.start_event_loop() |
Looking at
Which means that the clean-up for the Lines 174 to 182 in 0fb8373
So I think that calling invoke later with a callable that shuts down the event loop is an anti-pattern: it's guaranteed to leave a hanging timer + global state in By comparison This still doesn't answer the question about why this is failing on Linux. |
And here's a truly minimal reproducer. It's accessing the If I run the example below on Ubuntu and then quit the app manually (by clicking on the close button), I get a segfault. If I remove the I'll open issues and PRs tomorrow. from PySide6.QtWidgets import QApplication, QWidget
def main():
app = QApplication()
window = QWidget()
window.show()
app.thread()
app.exec()
if __name__ == "__main__":
main() |
I've tested a workaround that involves only doing the xref: enthought/envisage#509 |
The segfault persists with PySide 6.4.2, so doesn't appear to have been fixed upstream yet. |
This appears to be fixed in PySide 6.4.3 |
EDIT 2023-03-10: Upstream issue - https://bugreports.qt.io/browse/PYSIDE-2254
The script below sometimes gives me an end-of-process segfault on Ubuntu 22.04 with PySide 6.3.2.
See the docstring at the top of the code for steps to reproduce.
Results of a typical failing run on my machine look like this:
faulthandler
gives no extra information, presumably because the segfault happens sufficiently late in the Python process teardown that faulthandler is no longer running.The text was updated successfully, but these errors were encountered: