Experimental Physics and
| |||||||||||||||||
|
I guess there are two separate issues here: The whole point of the routine epicsThreadExitMain() is to arrange for the main thread to complete _without_ shutting down the other threads om the process. If you want to shut down an IOC completely, you have to call epicsExit() instead. The softIoc implementation will do this if you tell it to start an interactive shell (use the -s option in R3.14.9; in R3.14.10 -s does nothing and the default is to start a shell unless you explicitly say -S). If you don't ask for an interactive shell there's nothing for the main thread to do after loading databases so it calls epicsThreadExitMain(). At this point the process looks like a zombie, but it has many other threads still running (ls /proc/<pid>/task). If you kill -9 one of these other threads the whole process should shut down and the zombie goes away. If you want to be able to shut down a softIoc using Control-C, you have to start an interactive shell. If you want to be able to shut down a softIoc that has no interactive shell, load the softIocExit.db and do a caput to its $(IOC):exit PV which causes epicsExit() to be called. 2. RHEL appears to have an unpleasant bug involving process cleanup -- how else do I have persistent zombies owned by init? Or else I'm missing something... See above, there are still other threads running in the process. The iocsh() call is necessary to reproduce the problem.... Curious. I would have expected the _exit(0) call to have done everything that's necessary. As far as I can tell from the man page, _exit is pretty well guaranteed to terminate the program. The _exit() call does not trigger the atexit() callbacks which trigger the shutting down of the other threads. In your example, iocsh() calls errlogFlush() which calls errloginit() which starts the errlog thread. This initialization is rather unfortunate, but it would take some work to arrange for the errlog thread to only be started when there is actually some work for it to do. I would love to see that done if someone wants to take it on. HTH, - Andrew -- Talk is cheap. Show me the code. -- Linus Torvalds
| ||||||||||||||||
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |