Use abort() instead of exit() in xio error handler?

Lubos Lunak l.lunak at
Mon Jun 1 21:02:04 BST 2009

On Monday 01 of June 2009, Christoph Feck wrote:
> Hi,
> I am currently looking at and
> was wondering if it would make sense to change xio error handler to use
> abort() instead of exit(), effectively bypassing the static cleanup
> functions that some KDE components register. Those cleanup functions seem
> to cause this and other wired crashes (just grep bko for "exit()" :)
> If X11 decides to assert (maybe because of the evil XCB bug), it should not
> create backtraces that suggest completely unrelated bugs.

 The XIO error handler is not an assert, it is called when the connection to 
the X server is reset (X crashes/terminates, there's a network problem when 
using remote X, etc.). That is not a bug, it is a situation that can normally 
happen, although there isn't really much to do about it, since if nothing 
else Xlib requires that the XIO handler terminates the application. Still, it 
is not something exceptional and there I don't think it should lead to 
abort() (note that with some setups, which would make every 
Ctrl+Alt+Backspace create a bunch of core files). If there are global 
objects, they should be able to survive XIO handler called.

 In this specific bugreport, there's indeed the interesting detail that the 
report is from DrKonqi, so it doesn't look like X actually went away. The 
other assumption that appears to be wrong is that the problem has to do with 
global objects, as the backtrace with the XIO handler looks harmless - it is 
just sleeping. The crash is in thread #2, in what looks like glibc's free().

 My guess that there is a memory corruption, which would explain the crash, 
and it could also explain the XIO handler called (either it got somehow 
triggered by the corrupted heap, or maybe somebody played with thread safety 
and lost, IIRC that can lead to XIO handler called too). I expect the other 
similar bugreports are similar problems.

 PS: What is "the evil XCB bug"? A vast majority of asserts in XCB are 
actually application bugs.

Lubos Lunak
KDE developer
SUSE LINUX, s.r.o.   e-mail: l.lunak at , l.lunak at
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic

More information about the kde-core-devel mailing list