Skip to content
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

Segmentation fault on Qt5Agg when using the wrong linestyle #6816

Closed
Dapid opened this issue Jul 22, 2016 · 9 comments
Closed

Segmentation fault on Qt5Agg when using the wrong linestyle #6816

Dapid opened this issue Jul 22, 2016 · 9 comments
Milestone

Comments

@Dapid
Copy link

Dapid commented Jul 22, 2016

The following program triggers an Python error and a segmentation fault (notice that the correct linestyle is -.):

import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
plt.hist([0, 1, 1, 2], linestyle='.-')
plt.show()

plot sanitizes the input, so this just produces a ValueError.
import matplotlib.pyplot as plt
plt.plot([0, 1], [1, 2], linestyle='.-')

The backends Qt4Agg and TkAgg also raise an error, but don't produce a hard crash.

My system is Python 3.5 on a virtual environment with matplotlib built from source via pip.

Full traceback for the aborting snippet:

Traceback (most recent call last):
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py", line 176, in __draw_idle_agg
    FigureCanvasAgg.draw(self)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/figure.py", line 1159, in draw
    func(*args)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/axes/_base.py", line 2324, in draw
    a.draw(renderer)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/patches.py", line 494, in draw
    gc.set_linestyle(self._linestyle)
  File "/home/david/.virtualenv/py35/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 1064, in set_linestyle
    raise ValueError('Unrecognized linestyle: %s' % str(style))
ValueError: Unrecognized linestyle: .-
Aborted (core dumped)
@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Jul 22, 2016
@tacaswell
Copy link
Member

What version of mpl are you using?

@Dapid
Copy link
Author

Dapid commented Jul 22, 2016

Sorry, I forgot. 1.5.1, latest on Pypi

@anntzer
Copy link
Contributor

anntzer commented Sep 6, 2016

I can confirm the issue as of 1.5.1 and PyQt 5.6 (5.7 doesn't work with 1.5.1), but it is fixed as of 2.0b3 with both PyQt5.6 and 5.7.

@anntzer anntzer closed this as completed Sep 6, 2016
@tacaswell
Copy link
Member

@anntzer do we have any idea what fixed it? There is likely to still be a 1.5.3.

@anntzer
Copy link
Contributor

anntzer commented Sep 6, 2016

Bisected back to 3ef3f5b (basically, throwing exceptions at draw time is always going to be fatal for Qt5).

@tacaswell
Copy link
Member

ew, that is not something we can backport to 1.5

I suspect we are going to be playing wack-a-mole with qt5 for a while if raising at draw time is fatal...

@anntzer
Copy link
Contributor

anntzer commented Sep 6, 2016

See http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#unhandled-python-exceptions
Basically you can avoid this by overwriting sys.excepthook, but I'd rather not go that route...

@tacaswell
Copy link
Member

I guess in __draw_idle_agg we could catch and print the exceptions? That would get us back to the status-quo without overriding it for the rest of qt5?

@anntzer
Copy link
Contributor

anntzer commented Sep 6, 2016

I guess that could work, yes.

@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants