An Apache Tomcat server, I administrate, used to go away every now and then some time ago. To investigate the issue, I connected to the server via SSH, restarted it and monitored the log for a while. Tomcat ran well during this time. I disconnected and went home. Then the phone ringed, server had gone away.
Mind like water, I thought. I went into myself and thought what could have happened. There came up some facts:
- Some web app generates charts using jfreechart
- jfreechart uses AWT to generate the graphics
- Java AWT is native code that uses the unterlying graphics subsystem, on Linux the nearest X server
- I was connected using ssh with ForwardX11 on
Like Jerlock Holmes I combined the facts and came up with a solution:
unset DISPLAY
I put this statement into the Tomcat start script (before the start of Java of course). This will break the chain between my local X-Server and Java.
The server is still running well.