I use a GUI frame in the startup of my application and then it is supposed to be left to run as a daemon, but when I close the SSH session, the app crashes with the error:
X connection to localhost:10.0 host broken (explicit kill or server shutdown)
I isolated the problem with a small program:
Ssh to a remote machine and launch this program with
nohup
java T &
After providing the password, exit your SSH session (it will probably exit only after a Ctrl+C since it waits for the X connection to finish). Now when you SSH again to that machine to see if your daemon is running, you won't see it. At the end of the nohup.out, you'll see the ugly "explicit kill" message.
After this example, we can say that there is an open X connection being tunnelled throught the SSH session. So two questions:
1) Why does my Java process crash when this connection is broken?
2) How can I prevent this behavior? Maybe a way to close the x connection in my program, or make it not abort after a connection closure.
Thanks!
Joao.