0

I am using a telnet/ssh seesion on some server to run a specific simulator progrmam, and the program rely on a SIGTERM to exit itself(if not input "exit" string interactively).

The program will normally exit itself on most servers when I kill the telnet/ssh session directly. But on certain servers, my simulator will not recieve the SIGTERM signal, and keep running as a child of the ROOT process. Then those dangling processes will consume much CPU resource.

Could anybody give me some help where to look? Or how to address this situation?

Thanks, Kevin

Kevin Yu
  • 1,423
  • 4
  • 15
  • 19
  • If you know what servers it won't close down properly on, why not explicitly kill it before you log out? – Some programmer dude Aug 10 '12 at 07:29
  • Well normally, we will. But it is automatically startup by an automation program using expect then telnet to the server and run the simulator, sometimes the automation program may not exit gracefully due to its complexity. So... – Kevin Yu Aug 10 '12 at 07:30
  • On what servers is the SIGTERM not delivered? What else is different between these servers and those that do deliver SIGTERM? What operating system and ssh/telnet daemon software do they run? Which versions? – dave4420 Aug 10 '12 at 08:51

1 Answers1

0

Write a wrapper program that

  1. executes your simulator program
  2. when the simulator exits, exits itself
  3. when it becomes a child of the root process, sends SIGTERM to the simulator (and then SIGKILL a few seconds later if that has no effect)

This would be a terrible hack, but it's the best I can suggest based on the information you've provided so far.

dave4420
  • 46,404
  • 6
  • 118
  • 152
  • Dave, Thanks for the answer! Actually the simulator was started by a wrapper. I think I can utilize the wrapper to dump out signals the wrapper itself received, to see if there is any different between different servers. I'll get back to you. – Kevin Yu Aug 12 '12 at 13:57