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). 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.