Bug 376990 - Okular randomly crashes when launched from Emacs
Summary: Okular randomly crashes when launched from Emacs
Status: RESOLVED WORKSFORME
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-27 19:42 UTC by Tristan Miller
Modified: 2020-06-06 08:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
log of a crash while Okular was running through valgrind (14.16 KB, text/x-log)
2017-02-27 19:42 UTC, Tristan Miller
Details
Another valgrind log, this time with more debugging symbols (25.05 KB, application/octet-stream)
2017-03-04 17:52 UTC, Tristan Miller
Details
Yet another crash log. This one doesn't have the strange null characters. (35.53 KB, text/plain)
2017-03-05 12:52 UTC, Tristan Miller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Miller 2017-02-27 19:42:20 UTC
Created attachment 104250 [details]
log of a crash while Okular was running through valgrind

I use Emacs and AUCTeX to edit LaTeX files and to launch Okular 1.0.2 to view the resulting PDFs.  When Okular is launched this way, it randomly crashes -- usually as I'm scrolling through the document, but sometimes just when I'm sitting there reading it, or when Okular is idling in the background.  There's nothing in particular I can do to trigger the crashes; they just happen (usually within a few minutes).  So far I haven't noticed any crashes when launching Okular directly from the command line -- maybe it also crashes that way but I've just been lucky.

When Okular crashes this way, the window simply disappears; I don't get any crash dialog with a stack trace.

Attached is a log of a crash while Okular was running through valgrind.
Comment 1 Tristan Miller 2017-02-27 19:44:11 UTC
Possibly related to Bug 346264.  Let me know if you want me to install any other debug packages and I'll post some more logs.
Comment 2 Albert Astals Cid 2017-02-27 23:10:17 UTC
Whatever provides the debug symbols for /usr/lib64/qt5/plugins/xcbglintegrations/libqxcb-glx-integration.so
Comment 3 Tristan Miller 2017-03-04 17:52:39 UTC
Created attachment 104368 [details]
Another valgrind log, this time with more debugging symbols

Attached is another log of running the following via emacs:

/usr/bin/valgrind /usr/bin/okular --page 1 miller2017semeval.pdf >&/tmp/okular.log

This time I had more debugging packages installed.  I see the log contains a lot of null characters, following by what looks like some SQL statement.  This looks very strange to me.  Maybe valgrind itself crashed?
Comment 4 Tristan Miller 2017-03-05 12:52:54 UTC
Created attachment 104377 [details]
Yet another crash log.  This one doesn't have the strange null characters.

I attach another crash log, this one without the strange null characters.

Let me know if there's any further information you need.
Comment 5 Albert Astals Cid 2017-03-05 18:08:32 UTC
Which Qt version are you running? Is it self compiled? If not which distribution are you running?
Comment 6 Tristan Miller 2017-03-05 19:08:44 UTC
I'm running Qt 5.7.1 on openSUSE Tumbleweed.  I'm using the official binary packages, not compiled from sources.
Comment 7 Albert Astals Cid 2017-03-05 22:29:45 UTC
I'm sorry but your crash is deep down in Qt, nothing special that okular is doing, just trying to show a tooltip.

So it's either a bug in Qt or in your driver.

https://github.com/qt/qtbase/commit/8d9c42e36217e14efa69974c2cdc8d90f465a959 *may* be the fix for this crash, if you know how to ask the opensuse people to integrate that in their build it may be a good idea.

I'm going to set this as needs info, because with the info we have it very much looks like not our problem.
Comment 8 Tristan Miller 2017-03-06 15:24:19 UTC
Downstream bug report: https://bugzilla.novell.com/show_bug.cgi?id=1028126
Comment 9 Tristan Miller 2017-07-26 20:13:48 UTC
No longer reproducible for me.  I'm currently running Okular 1.1.2 with Qt 5.9.1.  I'm assuming I should mark this as RESOLVED/WORKSFORME.
Comment 10 jappel 2017-08-01 13:07:58 UTC
When opening an xterm from emacs instead of the viewer I find that a lot of qt programs crash deterministically if called from within this xterm (konsole, kruler, /usr/lib64/qt5/examples/gui/openglwindow/openglwindow). It turns out the guilty part is that emacs defines the environment variable XLIB_SKIP_ARGB_VISUALS, i.e. if I call 
XLIB_SKIP_ARGB_VISUALS='' okular then okular crashes as soon as i open the file menu no matter the actual value of the environment variable.

Workaround: call the viewer with  
'(("Okular"
   ("env -u XLIB_SKIP_ARGB_VISUALS okular --unique file:%o"
    (mode-io-correlate "#src:%n%a"))
   "okular"))
by setting TeX-view-program-list in AucTeX accordingly
Comment 11 Luigi Toscano 2017-08-01 13:15:05 UTC
(In reply to jappel from comment #10)
> When opening an xterm from emacs instead of the viewer I find that a lot of
> qt programs crash deterministically if called from within this xterm
> (konsole, kruler, /usr/lib64/qt5/examples/gui/openglwindow/openglwindow). It
> turns out the guilty part is that emacs defines the environment variable
> XLIB_SKIP_ARGB_VISUALS, i.e. if I call 
> XLIB_SKIP_ARGB_VISUALS='' okular then okular crashes as soon as i open the
> file menu no matter the actual value of the environment variable.

If you can reproduce with even demo/simple Qt5 applications, and maybe from an environment which is not Plasma, this may be a bug or a quirk in Qt; you may try to report it to Qt.
Comment 12 Tristan Miller 2017-09-09 10:51:31 UTC
(In reply to Luigi Toscano from comment #11)
> If you can reproduce with even demo/simple Qt5 applications, and maybe from
> an environment which is not Plasma, this may be a bug or a quirk in Qt; you
> may try to report it to Qt.

I can reproduce the problem reported by jappel@linux01.gwdg.de (i.e., KDE applications launched from Emacs crash when their pull-down menus are activated).  The problem occurs only when running Plasma, and only with KDE applications.  (That is, the problem does not occur with other desktop environments, such as LXQt, and the problem does not occur with non-KDE Qt applications, such as Clementine and Skype 4.3.0.37.)

Given this, where would be the best place to report this bug?
Comment 13 Albert Astals Cid 2017-09-09 16:44:13 UTC
Defenitely not an okular bug, i guess a Plasma bug makes sense since you say that you can only reproduce this inside a Plasma session.
Comment 14 Tristan Miller 2017-09-09 18:46:08 UTC
(In reply to Albert Astals Cid from comment #13)
> Defenitely not an okular bug, i guess a Plasma bug makes sense since you say
> that you can only reproduce this inside a Plasma session.

OK, reported as Bug 384540.