enthought / enthought/pyface

Import-time segmentation fault on a headless machine

Open
#465 4 comments 0 reactions 0 assignees View on GitHub
ETS Backlog
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

I have a Python virtual environment where I installed the `pyqt5` and `pyface` packages. On a machine, that I think is headless, the `import pyface.api` statement causes a segmentation fault:
```
(pyface-env)$ python
>>> import pyface.api
QML debugging is enabled. Only use this in a safe environment.
QXcbConnection: Could not connect to display
Aborted (core dumped)
(pyface-env)$
```

I would expect `pyface` to raise an exception instead of causing a segmentation fault, and possibly only at the time of windowing-related operations (rather than at import time).

Details reported by faulthandler

```
$ python -X faulthandler
Enthought Deployment Manager -- https://www.enthought.com
Python 3.6.5 |Enthought, Inc. (x86_64)| (default, Aug 19 2019, 17:42:28)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyface.api
QML debugging is enabled. Only use this in a safe environment.
QXcbConnection: Could not connect to display
Fatal Python error: Aborted

Current thread 0x00007f4e271cd740 (most recent call first):
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pyface/ui/qt4/init.py", line 40 in
File "", line 219 in _call_with_frames_removed
File "", line 678 in exec_module
File "", line 665 in _load_unlocked
File "", line 955 in _find_and_load_unlocked
File "", line 971 in _find_and_load
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449 in resolve
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443 in load
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pyface/base_toolkit.py", line 272 in find_toolkit
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pyface/toolkit.py", line 27 in
File "", line 219 in _call_with_frames_removed
File "", line 678 in exec_module
File "", line 665 in _load_unlocked
File "", line 955 in _find_and_load_unlocked
File "", line 971 in _find_and_load
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pyface/about_dialog.py", line 19 in
File "", line 219 in _call_with_frames_removed
File "", line 678 in exec_module
File "", line 665 in _load_unlocked
File "", line 955 in _find_and_load_unlocked
File "", line 971 in _find_and_load
File "/home/pzahemszky/.edm/envs/pyface-env/lib/python3.6/site-packages/pyface/api.py", line 17 in
File "", line 219 in _call_with_frames_removed
File "", line 678 in exec_module
File "", line 665 in _load_unlocked
File "", line 955 in _find_and_load_unlocked
File "", line 971 in _find_and_load
File "", line 1 in
Aborted (core dumped)
```

**Steps to reproduce:**
- `edm envs create --version 3.6 pyface-env`
- `edm shell --environment pyface-env`
- `edm install --yes pyface pyqt5`
- `python`, then type `import pyface.api`

**Information:**
- Red Hat Linux
- Python 3.6.5
- pyface 6.1.2
- pyqt5 5.7.1

**Additional notes:**
- If I install `pyqt` instead of `pyqt5`, then the segmentation fault is slightly different:

```
(pyface-pyqt-env)$ python -X faulthandler
>>> import pyface.api
: cannot connect to X server
(pyface-pyqt-env)$
```
- `import pyface.api` succeeds when only `pyface` is installed in the environment.
- `import pyface.api` succeeds on a different, not headless machine with the exact same package versions (though a different operating system).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.