java background process ended without error message - java

I have a small java server listening on port 10299 for performing some image processing on demand. I start the program as follows:
java -Xms15m -Xmx25m -jar /tools/image-server.jar > /tools/image-server.log &
After an indeterminate period of time the process gets killed whithout any error message (or at least i haven't discovered any...). The OS is Ubuntu 10.04.3 LTS.
The code itself seems to be working fine, since it is running without error on my other machine.
What could cause the unexpected ending of the program?
Is it possible to check which process killed the program?
Which log files could I check?

Related

How can I figure out why my Java application keeps on running after exit?

I'm developing a Java desktop application for Windows and I'm trying to implement the Windows Restart Manager. I'm successfully receiving the Windows messages for exiting the application and when I send them manually, it just works and the application shut downs.
When I do it as part of the uninstall process, the shutdown procedure in my application runs and I can even see it calls System.exit(0) but even after that, there's a process that doesn't stop. My Java application is packaged into an executable file using launch4j in case that's relevant.
The way I know System.exit(0) is being called is because I'm dumping debugging information to a file and I print out that System.exit(0) is about to be call and I can see that whether the application succeeds or fails on properly shutting down.
Using the Process Explorer I can see the javaw.exe sub-process and when the exit procedure happens, that goes away, but the parent process remains. While the is running, it looks like this:
and after the failed exit, it looks like this:
If I have a remote debugger connected to the process, at this point, the debugger gets disconnected.
What could be causing this?
I'm close to being convinced this is a bug in launch4j, so, I reported it here: https://sourceforge.net/p/launch4j/bugs/185/

Java: How to terminate the process created with ProcessBuilder("startx", "firefox")

How do I terminate the process I created with ProcessBuilder("startx", "firefox")? process.destroy() and process.destroyForcibly() don't work.
I'm starting a firefox kiosk, but only once the rest of the Java application is up and running (so that I can keep quick boot times and not have to wait for X to start). Is there a better way to do this than "startx firefox"? Is there a way of passing something to x to get it to close.
I need to restart the software to be able to update it. Obviously I'd rather not have to reboot the machine just to update it.

logging with subprocess in Python

I am launching a Java command through subprocess in Python.
JAVA_CMD = ['java', '-Xmx10200m', '-cp', '/path/to/class', '-Dlog4j.configurationFile=/path/to/logfile']
filename,k,mail = '/path/to/file2',"20", 'help#so.com'
subprocess.Popen(JAVA_CMD + [filename,K,mail], stdout=subprocess.PIPE)
## rest of the code
Above command runs for 24-48 hours.
Does anyone know if the logging in java command will work with above command? Currently I am able to launch the java command without having to wait for the response but, logging is not working. It is not creating any log files.
Also, is there an automatic timeout related to above process? One of the commands is dying again and again. It might be a problem in the code but I was wondering if subprocess has a timeout related to it which is killing the process.
Ideally what I want is the ability to launch a java command from within Python as if the command was launched by the user and the process should keep on running indefinitely, till it is completed. Python should be able to work on further without having to worry about the java command launched.

How to determine what kills my Java server in Ubuntu?

I have a Java server running on an Ubuntu machine and every few days it just... dies. Every exit point on every thread leaves a log entry and everything is wrapped in try-catch with a log entry in the catch, but on these mysterious shutdowns, nothing gets logged.
I launch the server with a simple nohup java -jar MyServer.jar command.
One time, I had a terminal I launched it from still open when this happened and the word "KILLED" showed up there. Note that, when I kill the server myself with a kill command from another terminal, nothing shows up.
How do I determine what killed it?

Java Process Not Terminating

I have a Java application launched via Webstart. About half the time, this program will not die. This program listens on a socket and when it receives a particular command, should close down. When it receives this command, it prints out what it normally should to the java console (that it received the shutdown command), the Java console closes, all the windows close, but the java process continues to run.
I have tried switching System.exit(0) to Runtime.getRuntime().halt(0) with no success - the same problem happens (my initial thought was a shutdown hook was affecting it).
Furthermore, when I have VisualVM connected to the Java process, it also indicates that it loses the connection when halt or exit are called, and I cannot reconnect, but the java process continues to exist.
Any ideas on how I could solve this? I've tries wrapping the program in try { } and exit/halt in finally { } to ensure nothing was holding it up, tried halting instead of exiting, etc...
My only thought is Java could be retaining a system resource (file handle to socket or something) or be stuck in a system call so the system won't let it quit - but the Java console closes, which to me seems like an indication the VM is trying to shutdown...
Any thoughts or ideas are appreciated!

Categories

Resources