enthought / enthought/pyface

Intermittent end-of-process segfault on Linux + PySide 6

Open
#1,211 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

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:

```
(crasher) mdickinson@ubuntu-2204:~/Desktop$ python -m unittest crasher.py
/home/mdickinson/Desktop/crasher/lib/python3.10/site-packages/pyface/util/guisupport.py:155: DeprecationWarning: 'exec_' will be removed in the future. Use 'exec' instead.
app.exec_()
.
----------------------------------------------------------------------
Ran 1 test in 0.018s

OK
Segmentation fault
```

`faulthandler` gives no extra information, presumably because the segfault happens sufficiently late in the Python process teardown that faulthandler is no longer running.

```python
"""
The script below segfaults for me around 10% of the time with:

- Ubuntu 22.04 (running under VirtualBox on a macOS Ventura / Intel host)
- Python 3.10 (installed from official Ubuntu package)
- PySide 6.3.2 (installed via pip)

To reproduce:

- Save this script under the name 'crasher.py'
- Create and activate a Python 3.10 venv with e.g.

python -m venv --clear crasher
source crasher/bin/activate

- Install pyface and PySide6 < 6.4 from PyPI:

python -m pip install pyface "PySide6<6.4"

- Run this script under unittest:

python -m unittest crasher.py

"""

import unittest

from pyface.gui import GUI
from pyface.tasks.api import TaskWindow
from traits.api import HasTraits, Instance

class MyTasksApplication(HasTraits):
window = Instance(TaskWindow)

def run(self):
gui = GUI()
window = TaskWindow()
window.open()
self.window = window
gui.invoke_later(self.exit)
gui.start_event_loop()

def exit(self):
window = self.window
self.window = None
window.destroy()
window.closed = True

class TestTasksApplication(unittest.TestCase):
def test_lifecycle(self):
app = MyTasksApplication()
app.run()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproduction steps and crasher.py in the issue, then inspect the traceback reference to pyface/util/guisupport.py and compare the behavior with upstream PYSIDE-2254. Done would require a clear diagnosis and an actionable resolution, but the report indicates that the underlying work has moved to the upstream issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, ubuntu
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.