[Solved] Bash: killing child processes

I decided to make a session manager that will kill all child processes before exiting, the only problem is that it doesn't kill them all.
I tried using the same function, and using it in conjunction with
yes >/dev/null & bash
yes >/dev/null & bash
yes >/dev/null & bash
yes >/dev/null & bash
running in a terminal, and it sent all of them the TERM signal.
I'm out of ideas.
Code is here.
The relevant section is:
# Kill child process of given parent
# This uses PIDs not names
# Also prints out a list of child pids that should be killed
# FIXME: Clean this up a bit
kill_child_processes()
PARENT_ID=$1
# Find child processes and put them in the form PID%seperator%COMMAND
local CHILD_PROCESSES=$(ps o ppid,pid,command | \
awk "{if (\$1 == $PARENT_ID) {print \$2,\"_\",\$3;}}" | \
sed 's| _ |%seperator%|')
# Do this for each child
for child in $CHILD_PROCESSES; do
# Extract the PID and COMMAND into separate variable from $child
local child_pid=$(echo $child | sed 's|%seperator%.*||')
local child_command=$(echo $child | sed 's|.*%seperator%||')
# If the child command has child processes, recurse through it
if [ "$(ps o ppid,pid,command | awk "{if (\$1 == $child_pid) {print \$2;}}")" != "" ]; then
kill_child_processes $child_pid
fi
# If the command isn't part of a blacklist, send it the TERM signal
if [ x$(for dont_kill_command in $DONT_TERM; do \
[ x$dont_kill_command == x$child_command ] && echo "MATCH"; \
done) == x"" ]; then
kill $child_pid &
# echo the PID so we can use it later
echo $child_pid
fi
done
Thanks.
Last edited by some-guy94 (2010-01-13 22:48:39)

gradgrind wrote:You might like to try pkill / pgrep with the -g option?
Unfortunately that isn't what I'm looking for, I want this to work with multiple sessions(not that difficult), and also work with other apps on other tty's.
Currently what it does is it runs ps o ppid,pid,command x which gives a nice table
1234 5678 command1
1234 5679 command2
and if the ppid matches the session's pid, it's pid is saved, and (this part is looped) if it has child processes, then the function is run on the pid, afterward the pid is killed.
It works when I separate the function from the rest of the script, but when it is in a session it fails to work properly.
Last edited by some-guy94 (2010-01-05 23:11:57)

Similar Messages

  • Killing child process, not just the shell

    Killing child process, not just the shell
    #241 - 07/11/03 11:30 AM
    Edit post Edit Reply to this post Reply Reply to this post Quote
    Hi,
    I am working on a system for automatically testing student submissions on an introductory course about unix scripting. The program works by running a test script on a student submission, using Runtime.getRuntime().exec(). The Process object has a limited life span of 10 seconds (by default), and if it is still running after these 10 seconds, Process.destroy() is used to kill it.
    A bug exists when one of the submissions being tested times out. When the destroy() method is used it leaves a child process running... since students can also run
    some tests from the file submission client, the number of hanging processes soon adds up as they test and test again to get it right before submission. Eventually this results in too many processes and the server keels over.
    Does anyone have any ideas on killing these hanging processes?

    Not much help, but I think this is a known bug ...
    http://developer.java.sun.com/developer/bugParade/bugs/4770092.html

  • [SOLVED] Bash: pkill a process after exiting from another one?

    Hi there, I use a program which calls another one, but when I close the first one, the second one is not closed automatically even if not anymore needed, so I have to do it manually.
    I tried a classic:
    firstprogram
    pkill secondprogram
    but, of course, this script closes immediately the secondprogram.
    So, what I supposed to do?
    Thank you in advance!
    Last edited by metre (2011-03-24 11:33:01)

    hbekel wrote:Hard to tell unless you show us some code or at least mention the method used to launch the subprocess. Generally you should wait(3) for your child processes to exit before exiting your parent process, or terminate the child manually when the parent exits, e.g decide yourself when it is "not needed anymore".
    thank you, I did it:
    firstprogram
    wait
    pkill secondprogram
    it works, woah

  • How to stop/kill child process?

    I am creating one process, and it will call another exe.
    Now both are running as a different process. When I am closing my application first process is destroyed by calling destroy method. But I can’t able to close second process.
    Thanks in advance.

    User845466 wrote:
    thanks,
    I have started my application by calling the first exe, then it will call second .exe.
    when i close my application it is destroying first .exe it is not destroying the second one. Due to this when i run my app once again it is showing your application already running.This isn't a java problem at this point.
    You have your "first exe".
    You have your "second exe".
    There are two possibilities.
    1. There is something in "first exe" that allows it to terminate the "second exe"
    2. There is no way to do that.
    You must determine which of those it is. And that process has nothing to do with java.
    If you determine that it is 1, then with that information you can then look to java to see if there is a way to invoke that. You cannot attempt to solve it with java however UNTIL you have the information.
    If it is 2 then you are left with finding an OS specific way to do the following.
    1. Locate the 'process' of the "second exe"
    2. Use 'process' to kill "second exe"
    Those steps have nothing to do with java. However once you know what those steps are it will be possible, but perhaps not easy, to implement via java (although still with OS specific functionality.)

  • To Kill Parent / Child process

    Hi ,
    I'm facing problem with killing a process. I'm using "kill -9 <ppid>"(ppid - parent process id) command to kill the process, this command kills the parent process but the associated child process is not killed.
    I'm new to this Solaris, and my question is
    Do killing the Parent process internally kills the child process too? if the child process is taking time, how to ensure that the child process is killed before killing the Parent process.
    Thanks in advance for your response.

    Do killing the Parent process internally kills the child process too?Hello.
    If the parent process ends (does not care if regular exit or kill) it sends a signal to all its child processes. This is equal to "kill -xxx <child_pid>" (sorry that I do not know the number "xxx" by now).
    By default this signal will kill the child process but it is a signal that can be caught or ignored. This means the child process can tell the operating system that it does not wish to be killed when the parent is killed, the parent exits or an explicit "kill -xxx" is sent. (Only two signals cannot be caught or ignored: SIGKILL and one that pauses the process.)
    Martin

  • [solved: answer=yes] Can child processes fork()?

    As an exercise, I've been wanting to design a shell with better string-handling capabilities than bash — get around the quote-escaping problem, etc. But before I continue, I need to know: are fork()-ed child processes allowed to themselves fork()?
    I ask because shells execute commands by fork()-exec(). But you start a subshell to a script? It then has to fork()-exec() the commands therein on its own...
    It seems like this wouldn't work because in the child process, fork() returns 0. Or is this only for the fork() call that created it?
    Last edited by Peasantoid (2009-05-23 18:11:35)

    They can. Daemons for example do this, and they simply use a structure like if fork() == 0 { if fork() == 0 { daemon_main() ; } EXIT* }
    *EDIT
    Last edited by Procyon (2009-05-23 17:36:47)

  • [Solved] Change shell in script and keep child processes in new shell?

    Hi all,
    I have been trying to replicate the following in a script:
    # optirun bash
    # wine steam
    I have tried using
    optirun bash -c "command"
    but apparently wine spawns programs as a child process and then terminates which exits the bash shell with optirun on it.  Is there a way to keep the child processes inside the same shell too?
    Thanks!
    Last edited by b4bblefish (2013-03-04 00:50:45)

    Don't think so.  I have tried the nvidia fix for it, but it doesn't work, but that might be because i'm using the bumblebee-nvidia package
    https://wiki.archlinux.org/index.php/Bu … display_:8
    https://github.com/Bumblebee-Project/Bu … leshooting
    Last edited by b4bblefish (2013-03-03 20:19:08)

  • Apache POST flex2gateway never closes or times out, reaches max child processes

    We have been trying to pass an external PCI scan, and noticed some server lockups after starting a scan.  We are scanning a couple hundred IP addresses, which all resolve to the same servers.  The scans are actively looking for vulnerabilities on the box, and one of which is flash remoting.  When we look at the apache /server-status page, it shows a ton of long running flex2gateway processes.  For instance:
    22-4
    4466
    0/3817/3817
    W
    4.07
    163840
    0
    0.0
    57.76
    57.76
    x.x.x.101
    WebNode2.ambassador.int
    POST /flex2gateway/http HTTP/1.1
    As you can see, this POST request has been running for 163840 seconds, or nearly two days.  Since it seems these POST requests never complete, even though the client has long since disconnected, they simply stack up until the server's max number of child processes has been reached, effectively killing our webserver.
    When I try to restart the clustered coldfusion instances one at a time, these POST requests do not die off.
    If I stop both clustered CF instances, the requests complete (or get killed).
    If I reload or restart apache, the requests are gone as well.
    strace gives me nothing useful:
    [root@WebNode1 ~]# strace -p 34025
    Process 34025 attached - interrupt to quit
    read(185,
    pstack gives a little more, but nothing that looks obvious to me:
    [root@WebNode1 ~]# pstack -p 34025     
    Usage: pstack <process-id>
    [root@WebNode1 ~]# pstack 34025  
    #0  0x00007fdd40444740 in __read_nocancel () from /lib64/libpthread.so.0
    #1  0x00007fdd33efe2e6 in jk_tcp_socket_recvfull () from /opt/coldfusion10/config/wsconfig/1/mod_jk.so
    #2  0x00007fdd33f1b68d in ajp_connection_tcp_get_message () from /opt/coldfusion10/config/wsconfig/1/mod_jk.so
    #3  0x00007fdd33f1ceea in ajp_get_reply () from /opt/coldfusion10/config/wsconfig/1/mod_jk.so
    #4  0x00007fdd33f20308 in ajp_service () from /opt/coldfusion10/config/wsconfig/1/mod_jk.so
    #5  0x00007fdd33ef8f5d in jk_handler () from /opt/coldfusion10/config/wsconfig/1/mod_jk.so
    #6  0x00007fdd41b92cd0 in ap_run_handler ()
    #7  0x00007fdd41b9658e in ap_invoke_handler ()
    #8  0x00007fdd41ba1c50 in ap_process_request ()
    #9  0x00007fdd41b9eac8 in ?? ()
    #10 0x00007fdd41b9a7d8 in ap_run_process_connection ()
    #11 0x00007fdd41ba6ad7 in ?? ()
    #12 0x00007fdd41ba6dea in ?? ()
    #13 0x00007fdd41ba7a6c in ap_mpm_run ()
    #14 0x00007fdd41b7e9b0 in main ()
    I dont know what that tells us exactly, but I'm leaning toward the hangup between apache and tomcat. 
    Any suggestions on where how to troubleshoot this issue?

    On a test server, I have removed the wildcard from the uriworkermap.properties file, so it now only matches "/flex2gateway" and "/flex2gateway/".  Unfortunately I'm still seeing the occasional hung apache worker. 
    Anyone have any leads on this issue?  I don't mind doing the research, I'v just exhausted the limits of my Google Fu.
    Apache Server Status for 10.10.10.205
    Server Version: Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips mod_wsgi/3.2 Python/2.6.6 mod_jk/1.2.32 mod_perl/2.0.4 Perl/v5.10.1
    Server Built: Oct 16 2014 14:48:21
    Current Time: Monday, 10-Nov-2014 16:49:22 EST
    Restart Time: Monday, 10-Nov-2014 15:25:16 EST
    Parent Server Generation: 0
    Server uptime: 1 hour 24 minutes 6 seconds
    Total accesses: 5313 - Total Traffic: 98.4 MB
    CPU Usage: u3.97 s1.26 cu0 cs0 - .104% CPU load
    1.05 requests/sec - 20.0 kB/second - 19.0 kB/request
    15 requests currently being processed, 11 idle workers
    WWWWWWW_W_W_W__W__W__WW_W_...................................... ................................................................ ................................................................ ................................................................
    Scoreboard Key:
    "_" Waiting for Connection, "S" Starting up, "R" Reading Request,
    "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
    "C" Closing connection, "L" Logging, "G" Gracefully finishing,
    "I" Idle cleanup of worker, "." Open slot with no current process
    Srv
    PID
    Acc
    M
    CPU
    SS
    Req
    Conn
    Child
    Slot
    Client
    VHost
    Request
    0-0
    8727
    0/12/12
    W
    0.03
    4572
    0
    0.0
    0.05
    0.05
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    1-0
    8728
    0/11/11
    W
    0.03
    4358
    0
    0.0
    0.18
    0.18
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    2-0
    8729
    0/38/38
    W
    0.04
    3910
    0
    0.0
    1.11
    1.11
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    3-0
    8730
    0/27/27
    W
    0.03
    4064
    0
    0.0
    0.79
    0.79
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    4-0
    8731
    0/16/16
    W
    0.03
    4354
    0
    0.0
    0.12
    0.12
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    5-0
    8732
    0/7/7
    W
    0.02
    4564
    0
    0.0
    0.02
    0.02
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    6-0
    8733
    0/8/8
    W
    0.02
    4673
    0
    0.0
    0.01
    0.01
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    7-0
    8734
    0/386/386
    0.37
    4
    0
    0.0
    6.49
    6.49
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/login_over.jpg HTTP/1.1
    8-0
    9422
    0/10/10
    W
    0.02
    4564
    0
    0.0
    0.04
    0.04
    10.10.2.201
    qc.company.int
    POST /flex2gateway HTTP/1.1
    9-0
    10112
    0/393/393
    0.37
    6
    0
    0.0
    14.59
    14.59
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/box_onesource.jpg HTTP/1.1
    10-0
    10468
    0/321/321
    W
    0.32
    846
    0
    0.0
    4.42
    4.42
    10.10.2.212
    qc.company.int
    POST /flex2gateway HTTP/1.1
    11-0
    10470
    0/398/398
    0.38
    6
    0
    0.0
    12.80
    12.80
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/home_eco.jpg HTTP/1.1
    12-0
    10471
    0/340/340
    W
    0.32
    837
    0
    0.0
    4.99
    4.99
    10.10.2.212
    qc.company.int
    POST /flex2gateway/ HTTP/1.1
    13-0
    10544
    0/404/404
    0.34
    6
    0
    0.0
    5.21
    5.21
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/box_top.jpg HTTP/1.1
    14-0
    10592
    0/353/353
    0.40
    6
    12
    0.0
    14.10
    14.10
    10.10.2.212
    www.company.qc
    GET /?login HTTP/1.1
    15-0
    10648
    0/296/296
    W
    0.31
    800
    0
    0.0
    3.82
    3.82
    10.10.2.212
    qc.company.int
    POST /flex2gateway/ HTTP/1.1
    16-0
    12382
    0/339/339
    0.33
    6
    0
    0.0
    2.85
    2.85
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/logo_sourceone.jpg HTTP/1.1
    17-0
    12387
    0/336/336
    0.34
    6
    0
    0.0
    5.06
    5.06
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/logo_onesource.jpg HTTP/1.1
    18-0
    12388
    0/265/265
    W
    0.25
    839
    0
    0.0
    2.87
    2.87
    10.10.2.212
    qc.company.int
    POST /flex2gateway/ HTTP/1.1
    19-0
    12389
    0/323/323
    0.31
    0
    0
    0.0
    4.82
    4.82
    10.10.2.212
    www.company.qc
    GET /marketingpages/lib/dimming.js HTTP/1.1
    20-0
    12390
    0/336/336
    0.31
    4
    0
    0.0
    5.24
    5.24
    10.10.2.212
    www.company.qc
    GET /marketingpages/lib/superfish.js HTTP/1.1
    21-0
    12391
    0/289/289
    W
    0.27
    805
    0
    0.0
    2.49
    2.49
    10.10.2.212
    qc.company.int
    POST /flex2gateway/ HTTP/1.1
    22-0
    12392
    0/281/281
    W
    0.27
    831
    0
    0.0
    3.17
    3.17
    10.10.2.212
    qc.company.int
    POST /flex2gateway HTTP/1.1
    23-0
    14750
    0/41/41
    0.04
    6
    0
    0.0
    0.92
    0.92
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/close.jpg HTTP/1.1
    24-0
    14751
    0/43/43
    W
    0.04
    0
    0
    0.0
    1.21
    1.21
    10.10.2.36
    qc.company.int
    GET /server-status HTTP/1.1
    25-0
    14752
    0/40/40
    0.04
    6
    0
    0.0
    0.96
    0.96
    10.10.2.212
    www.company.qc
    GET /marketingpages/images/box_sourceone.jpg HTTP/1.1

  • Inserting a Recordset Kills PHP Processing

    In Dreamweaver 11.0 (CS5) on both MAMP and a live server, I am experiencing a puzzling issue.
    Inserting any Recordset kills PHP processing.  For example, this document works perfectly:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Untitled Document</title>
    </head>
    <body><?php echo “Hello, world.” ?><?php phpinfo() ?></body>
    </html>
    As soon as I add any Recordset to the page, those two php statements simply stop working. In fact, the Recordsets return no data on the page. After I delete the Recordset code that Dreamweaver had inserted, and restore the page, php statements magically begin working again!
    (During the creation of the Recordset, the Test button confirms all columns are present, and the two rows are fine.)
    Any clue to what’s going on?

    I've solved part of this issue. It turns out that Dreamweaver copies to the testing server all new files and changes to files EXCEPT... the Connections folder it creates and that folder's contents. The user needs to do that manually.
    However, after I copied the Connections folder, Dreamweaver refuses to Insert any Data Object.
    For example, it won't insert a Repeat Region or a Dynamic Table. When I select
    Insert->Data Objects->Dynamic Data->Dynamic Table
    Dreamweaver returns this error:
    While executing insertObject in DynamicTable.htm, a JavaScript error occurred.
    Ditto the Repeat Region.

  • What is "child processes" if using OS Fetchlet with "em_metric_timeout"?

    On page 330 of document <Oracle® Enterprise Manager Extensibility Guide 10g Release 5 (10.2.0.5) B40007-02>, there are a description of using "em_metric_timeout" with OS Fetchlet as below,
    Parameter : em_metric_timeout
    Type : integer
    Description :
    Metric timeout period (in seconds). After the timeout period has finished, the Management Agent returns a timeout >exception and terminates any child processes that may have been created. The Management Agent DOES NOT kill >any of the grandchild processes. Specify "-1" for no timout period.
    Use : OptionalWhat does "child processes" mean here?
    Any help will be appreaciated!!!
    Thanks,
    Satine

    I would assume it means the process created to run your script to collect the data, but if you create any processes in that script (grandchild processes) the agent won't get those.

  • Isolating and Killing Runaway Processes

    How does one go about isolating and kiling a runaway PL/SQL process? I decided that it would be fun to call a
    procedure within a package that had an improperly coded loop, coded by yours truly. I called they package and
    then noticed that it seemed to be taking too long. Upon reviewing the code, I noticed that I my program was
    now stuck in an infinite loop. Since this process had run off on its own, I tried to complie it to fix the problem and
    much to my dismay I could not even complie the code, even though I was able to read the source to my screen.
    Where can one look to gleen some information as to how to kill the instance of the demon child without having to do
    what my DBA did and restart out database instance? Any v$ views etc?

    If you are in sqlplus when it locks up, you can simply enter <control> c
    that should kill the process. If you close your sqlplus session in any other way than standard exit procedures, depending on your setup, you either wait for pmon to find the defunct process or the administrator has to kill it for you.

  • Killing child kills Java parent

    I have a Java process that is a child of the Solaris SMF and the Java starts it's own child process. When I kill Java's child then the Java process dies also. No standard output or error output. It just disappears and stops executing.
    1: root@TestHost4:/ >ptree 9797
    2: 7     /lib/svc/bin/svc.startd
    3:   9797  java -jar <PathToJarFile> run
    4:     10005 /opt/bin/perl -w <PathToPerlScript>
    5: root@TestHost4:/ >kill 10005
    6: root@TestHost4:/ >ptree 9797
    7: root@TestHost4:/ >The perl script (line 4) is a child of the java app (line 3). When I kill the script (line 5) I end up also killing the java app (line 6)
    How can I kill the child but not the parent?
    I wrote the Java app myself and there is nothing in the logic that would cause all the threads to end or that would cause a call to System.exit except immediately after a logged message of the intention

    If it it being killed then it wouldn't call System.exit() of course.There are 3 processes, SMF, Java and child. When the child is killed, the Java process dies
    The child process is being created via Runtime.exec/ProcessBuilder right?Right
    I think I have the answer in another thread
    [http://forums.sun.com/thread.jspa?messageID=10567703&#10567703]

  • Urgent: Child process closed admin channel on Solaris 9 and 6.1 SP5

    Hi
    I'm facing this issue on Solaris 9 and Sun AppServer 6.1 SP5, the appserver crashes for some reason and restarts itself. There doesnt seem to be any specific instance which leads to this error. I notice that if I leave my application running for a while I end up seeing this error and I need to kill the instance that was running and restart the server instance.
    This is what i see in the log files before the server restarts itself.
    " failure (12181): CORE3107: Child process closed admin channel"
    It seems like i'm not the only one seeing this issue:
    http://swforums.sun.com/jive/thread.jspa?threadID=55040&messageID=210473
    http://forum.sun.com/jive/thread.jspa?threadID=95718&messageID=328813
    Anybody knows what could be going on?
    Thanks

    After the corefile is written, use pstack on it. In the pstack file you a stacktrace of the crashing function. Alas, this information is only useful when you have the sources.
    Also, usually there are other, more specific lines in the errors logfile e.g.:
    [27/Jan/2006:07:38:55] catastrophe (15456): CORE3260: Server crash detected (signal SIGSEGV)
    [27/Jan/2006:07:38:55] info (15456): CORE3262: Crash occurred in function INTprepare_nsapi_thread from module /opt/SUNWwbsvr/bin/https/lib/libns-httpd40.so
    [27/Jan/2006:07:38:55] failure (15455): CORE3107: Child process closed admin channel
    If you post them, maybe somebody can give you a hint...

  • Firefox will be hung when begining to download a file. Only using the tasker to kill the process can be resolved.

    when beginning to download a file especially a big file, my firefox will be hung, and it will occupy about 50% of the cpu resource. I can only kill the process to solve this problem.
    The problem was happened before installing the plugin "flashgot".
    this problem was occured in version 3.6.12 too.

    Questions:
    * How can I download a binary file like an mp3 from a server to a client?There are a ton of examples on the internet on how to download files. If you are having a problem, please post your code.
    >
    * Where I have to put my server application? I supose that I must create a jar, save it on a folder and execute it at PC start-up, right?Your server application will exist on a server and will run the application. hence the reason for the server. The best best for you is to read some online tutorials on client/server and how it works.

  • JVM spawning mysterious child process of itself using Runtime.exec()

    Hello, I'm not sure if this is how this is supposed to work but I have a java application that monitors legacy c programs and after a period of time (its intermittent), I'll see a duplicate jvm process running the same classpath, classname as a child of the java application monitor. This behaviour can be reproduced with the following simple class running on either solaris 9 or 10 using 1.6.0_03-b05:
    public class Monitor {
    Process procss;
    public Monitor() {
    try {
    Runtime runtime = Runtime.getRuntime();
    for (int i = 0; i < 10000; i++) {
    System.out.println("execing command ls -l.");
    procss = runtime.exec("ls -l");
    procss.waitFor();
    catch (Exception e) {
    e.printStackTrace();
    public static void main(String[] args) {
    new Monitor();
    Using java -classpath ./ Monitor to run it. While this is running, at intermittent times doing a ps -ef you will see a duplicate jvm running whose parent process is the one that was started on the command line. Ie:
    UID PID PPID etc
    user 17434 10706 .... java -classpath ./ Monitor (the one I put running)
    user 27771 17434 .....java -classpath ./ Monitor (intermittently started)
    in another window I'll run the following shell script that will output the processes when a duplicate java process gets started as they don't seem to run very long (on my production system they will occasionally get hung up until I manually kill them):
    #!/usr/bin/ksh
    while ((1 == 1))
    do
    ps -ef | grep "Monitor" | grep -v grep > /tmp/test.out
    VAL=`cat /tmp/test.out | wc -l`
    if (($VAL != 1))
    then
    echo "Duplicate java process started"
    cat /tmp/test.out
    fi
    done
    It takes roughly 30 seconds before I start to see duplicate jvms starting to run. The concern is that is the new jvm instance running the Monitor class? Eventually on my production system the real application will have a child or 2 linger indefinetly, and threads will be deadlocked. Once I kill these child java processes, everything is back to normal. This doesn't seem to occur with the above java class but will show the duplicate child jvm's start to run after a bit.

    This is true for Solaris and Linux. Sun's implementation does a fork. A lot of people who have very large memory java applications wish there was a way to create a process from Java that doesn't involve copying the parent process. As far as I know your stuck.
    A workaround: Use jms, rmi, sockets, or files to communicate with a low memory footprint java application whose sole purpose is to spawn child processes.

Maybe you are looking for

  • Difference in LOCL print preview for same script in two different systems

    Hi All, When I am testing a dunning letter ( Custom sapscript) in my testing system the LOCL print preview is correct...When I am testing  it in my development system by taking print preview from LOCL it is not printing a uline and some line item hea

  • Help with applets and shape/pixel detection

    hi im currently trying to write my first propear programming project, its a little evolving ecosystem but ive hit a stumbling block. im trying to write a method which returns an array of positions around a calling creatures location filled with numbe

  • How to change content of mobile wiki?

    Is it possible to change the layout and/or contents of the mobile version of the wiki server? I want to change the front page you get when you go to your wiki using an iPhone/iPad. On the desktop version, you can create a custom welcome page, but how

  • How to create a new UoM and assigning it to characteristic?

    Hi, How to create a new UoM and assigning it to characteristic? i want to enter cost ( in rupees and laks) against a counter but for that counter charecteristic required and for taht charecteristic unit of measure Rs and Laks are not defined in the s

  • Posting sound files

    I just noticed that while no audio formats are supported in the "Attach Files" box, we can post various image formats, video formats (.mov and .swf), and text. So, to post audio, one could upload a bitmap of a sound file for importing into Audition;