massdosage / citrine-scheduler

Java web application which can be used to configure, manage and monitor the running of various tasks
Apache License 2.0
4 stars 4 forks source link

Stopping a running task doesn't end the remote processes #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a task which uses the sysExecJob to run something like "ssh 
someserver.com/somescript.sh" 
2. somescript.sh should in turn do something like 
java com.example.SomeJavaApp $@
exit $?
3. Have the above Java program do something that takes a long time
4. While it is still running try stop the task from the Citrine web ui.
5. The ps on the citrine server shows the task as gone but the script and the 
forked java process still show as running on the remote server.

What is the expected output? What do you see instead?
Stopping a task should stop all forked processes, on remote machines too.

Original issue reported on code.google.com by massdosage on 20 Sep 2010 at 5:17

GoogleCodeExporter commented 9 years ago

Original comment by massdosage on 22 Sep 2010 at 11:09

GoogleCodeExporter commented 9 years ago
Command in 1 should be more like:

ssh user@host bash /path/to/script.sh args

Original comment by massdosage on 22 Sep 2010 at 11:59

GoogleCodeExporter commented 9 years ago
This actually is not a Citrine-specific issue but can be reproduced running the 
above commands using just the command line. The problem is the SSH command not 
knowing about the processes it has forked on the remote server. The way to fix 
this is to add the "-t" flag when issuing the ssh command. When doing this from 
Citrine one needs to add "-tt" to get it to work as the Java process itself 
doesn't have a terminal.

So the Citrine command should look something like this:

ssh -tt user@host "/path/to/someScript.sh"

Then when the task is stopped from Citrine it will in turn stop the remote 
forked processes.

Original comment by massdosage on 22 Sep 2010 at 1:59