<AWT Dev> VM shutdown upon X server termination

Philip Race philip.race at oracle.com
Mon Jun 7 22:53:12 UTC 2021

So if it returns and exit() is immediately called, how does that cause a 
crash ?
It seems to be just the same as if the handler called exit() directly 
and so did not return.
I would have thought a crash more likely if it didn't return and tried 
to keep the program running,
which might be effectively what you temporarily do if you call JVM_Halt().


On 6/7/21 11:21 AM, Maxim Kartashev wrote:
> When the X server suddenly dies, Xlib would usually (or maybe always) 
> discover this as an I/O error. It will then call the function 
> installed with XSetIOErrorHandler() and expects that the function will 
> not return ("the called routine should not return" from 
> https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XSetIOErrorHandler.html 
> <https://tronche.com/gui/x/xlib/event-handling/protocol-errors/XSetIOErrorHandler.html>). 
> If the handler returns, Xlib will simply call ::exit().
> AWT installs awt_GraphicsEnv.c`xioerror_handler() as such a function 
> and it _does_ return. I was wondering if it would be prudent to 
> properly terminate VM from the handler (with JVM_Halt(), perhaps)? We 
> are getting many reports of JVM crashes on Linux that seem to be 
> connected with the sudden disappearance of the X server, but I wasn't 
> able to reproduce this so can't be sure that this is the issue we are 
> facing.

More information about the awt-dev mailing list