Child Process resource cleanup

the problem I am having in my application is that resources are "leaking" (but not really) because memory is not used a lot (all the work is done by child processes) but since Process class does not have any means to explicitly release system resources taken by .exec, I ended up having a bug (.exec would fail after a while). Only after adding rtm.gc() the application worked as expected.
I have code something like this:
final Runtime rtm = Runtime.getRuntime();
try {
Thread.sleep(5000);
for (int i = 0; i != 100; ++i) {
Process prc = rtm.exec(new String[] {
          "cmd.exe", "/C","\"echo hello\""                     });
Thread.sleep(1000);
prc.waitFor();
rtm.gc(); // without this, it will NOT release resources
System.out.println("finished");
Thread.sleep(20000);
} catch (Exception e) { 
qeustion is: is there not a way to release child process' resources without having to call garbage collection?

My child process does terminates correctly.
It looks like Process object is not freeing up resources it holds for the process (input/output/err streams and process handle itself). Since gc does not kick in (there is almost no memory consumption), it takes a long time until it's cleaned up (if ever)
Adding:
prc.getOutputStream().flush();
prc.getOutputStream().close();
prc.getInputStream().close();
prc.getErrorStream().close();
after
prc.waitFor();
changes things a bit, it reduces number of handles process still holds (after the child process has finished execution) to 1. There is still, however, one handle held by the Process object, my guess is - process handle.
It is a pitty there is no way to "tell" process object to release this one last handle. Or maybe there is?

Similar Messages

  • Coldfusion 10 Enterprise with Tomcat + mod_jk and Apache2 experiencing child process hangups

    I am experiencing the most bizarre thing that so far I am unable to reproduce with my own visits to the site.
    After restarting Apache2 my cacti graphs show that the child processes increment consistently over the course of a day without dropping back down during off hours.  This behavior eventually leaves the website inaccessible...
    Looking at server-status it is filled with Ws (Sending Reply) and GET calls to my cfm applications :
    Current Time: Tuesday, 22-Jul-2014 16:33:00 PDTRestart Time: Monday, 21-Jul-2014 22:51:12 PDTParent Server Generation: 0Server uptime: 17 hours 41 minutes 48 secondsTotal accesses: 194844 - Total Traffic: 3.8 GBCPU Usage: u201.55 s34.46 cu0 cs0 - .37% CPU load3.06 requests/sec - 63.2 kB/second - 20.6 kB/request73 requests currently being processed, 4 idle workers
    WWWWWWWWWWWWWWWWWWWWWWWWWKWWWWWWWWWWWWWWWWWCWWWWW_WWWWWWCWWW_WWW _WKW...KWW.W_KWW....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
    15074
    0/46/1370
    W
    7.39
    46158
    0
    0.0
    0.44
    23.89
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=7000 HTTP/1.1
    1-0
    11563
    0/47/468
    W
    2.75
    58867
    0
    0.0
    4.69
    13.64
    192.168.1.10
    www.mysite.edu
    GET /catalog/index.cfm?courselist=list&dept=&searchc=PEHW%20148
    2-0
    12906
    0/65/884
    W
    7.30
    54536
    0
    0.0
    0.80
    14.62
    192.168.1.10
    www.mysite.edu
    GET /athletics/resources/nwaacc-athlete-of-the-week/ HTTP/1.1
    3-0
    13840
    0/41/1085
    W
    4.01
    51162
    0
    0.0
    0.56
    20.57
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=17001 HTTP/1.1
    4-0
    15928
    0/20/1635
    W
    5.40
    43715
    0
    0.0
    0.06
    41.37
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=37000 HTTP/1.1
    5-0
    18774
    0/19/2387
    W
    0.33
    34564
    0
    0.0
    0.24
    52.70
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=19009 HTTP/1.1
    6-0
    4321
    0/36/6612
    W
    3.61
    13200
    0
    0.0
    0.28
    129.74
    192.168.1.10
    www.mysite.edu
    GET /directory/index.cfm?directory=department&deptexp=28011 HTT
    7-0
    13077
    0/0/808
    W
    0.42
    54383
    0
    0.0
    0.00
    24.81
    192.168.1.10
    www.mysite.edu
    GET /directory/index.cfm?directory=department&deptexp=6005 HTTP
    8-0
    16488
    0/118/1673
    W
    12.39
    40692
    0
    0.0
    1.30
    35.44
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=31003 HTTP/1.1
    9-0
    10726
    0/15/110
    W
    0.58
    61963
    0
    0.0
    0.05
    1.83
    192.168.1.10
    www.mysite.edu
    GET /directory/index.cfm?directory=All&index=Q HTTP/1.1
    10-0
    13154
    0/1/688
    W
    0.00
    54165
    0
    0.0
    0.00
    16.83
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=All&firstname=Patrick&lastname=Murphy
    11-0
    12590
    0/25/516
    W
    4.45
    55851
    0
    0.0
    0.76
    11.19
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=4000 HTTP/1.1
    12-0
    12551
    0/13/454
    W
    1.84
    56055
    0
    0.0
    0.38
    10.00
    192.168.1.10
    www.mysite.edu
    GET /directory/index.cfm?directory=department&deptexp=20001 HTT
    13-0
    13333
    0/23/626
    W
    3.86
    53189
    0
    0.0
    0.57
    11.66
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=31005 HTTP/1.1
    14-0
    12410
    0/13/387
    W
    2.70
    56484
    0
    0.0
    0.42
    10.55
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=6003 HTTP/1.1
    15-0
    13162
    0/70/389
    W
    10.81
    53114
    0
    0.0
    0.86
    5.60
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=6005 HTTP/1.1
    16-0
    12309
    0/22/275
    W
    2.23
    56878
    0
    0.0
    0.43
    3.91
    192.168.1.10
    www.mysite.edu
    GET /directory/?directory=department&deptexp=20005 HTTP/1.1
    17-0
    13163
    0/57/341
    W
    11.85
    53120
    0
    0.0
    1.38
    6.49
    192.168.1.10
    www.mysite.edu
    GET /catalog/index.cfm?courselist=list&dept=&searchc=ENGR%26%20
    I have straced a hung process to only find the following :
    strace -p 6472
    Process 6472 attached - interrupt to quit
    read(23,
    Another interesting bit of info, none of these GET requests make it into my access.log file which I find very peculiar as well.
    Here are my CF Specs
    Server Details
    Server Product ColdFusion
    Version 10,0,13,287689
    Tomcat Version 7.0.23.0
    Edition Enterprise 
    Serial Number
    Operating System UNIX 
    OS Version 3.2.0-65-generic 
    Update Level /opt/coldfusion10/cfusion/lib/updates/chf10000013.jar 
    Adobe Driver Version 4.1 (Build 0001) 
    JVM Details
    Java Version 1.6.0_29 
    Java Vendor Sun Microsystems Inc. 
    Here are my Apache2 Specs
    Server version: Apache/2.2.22 (Ubuntu)
    Server built:   Apr 17 2014 21:49:25
    Server's Module Magic Number: 20051115:30
    Server loaded:  APR 1.4.6, APR-Util 1.3.12
    Compiled using: APR 1.4.6, APR-Util 1.3.12
    Architecture:   64-bit
    Server MPM:     Prefork
      threaded:     no
        forked:     yes (variable process count)
    Server compiled with....
    -D APACHE_MPM_DIR="server/mpm/prefork"
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_SYSVSEM_SERIALIZE
    -D APR_USE_PTHREAD_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D DYNAMIC_MODULE_LIMIT=128
    -D HTTPD_ROOT="/etc/apache2"
    -D SUEXEC_BIN="/usr/lib/apache2/suexec"
    -D DEFAULT_PIDLOG="/var/run/apache2.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="mime.types"
    -D SERVER_CONFIG_FILE="apache2.conf"
    I am hoping this is no normal behavior for Coldfusion 10.
    Many thanks in advance.

    We're having the same problem, although with CF11.

  • 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

  • Tracing Java Processes that spawns child process

    I hope I'm posting this in the correct group. If not, please let me know where to direct this question:
    In our 12.1.3 Applications, we installed a plugin called 'Org Chart' by Applaud Solutions.  It is a flash component that graphically displays the employee hierarchy of an organizations and is accessed via responsibility.  This tool also has a feature to 'export' the chart as a  Microsoft Word or PowerPoint to the users desktop.  When this occurs, a 'java' process is kicked off on the applications server to process this request.  Now, here's the issue: The performance of this export is terrible!  It takes roughly about 2-3 minutes to complete, and sometimes never completes.  Here is the java process that gets kicked off for one user which i figured out how to run manually:
    [applprod1@aspapp012 ~]$ java -jar OpenOfficeGenerator.jar /u01/applprod1/PROD1/apps/apps_st/appl/xxas/1.0.1/out/orgchart-f78b7a67-a379-4f7d-9dcf-5f13b22e03e4.xml /tmp/ed.pptx docx NameandTitle letter Y normal
    When I kick this off, I'm able to get the linux PID :
    9056
    22523 24779 62 16:21 pts/0
    00:00:06 java -jar OpenOfficeGenerator.jar /u01/applprod1/PROD1/apps/apps_st/appl/xxas/1.0.1/out/orgchart-f78b7a67-a379-4f7d-9dcf-5f13b22e03e4.xml /tmp/ed.pptx docx NameandTitle letter Y normal
    Then, I run an 'strace -f -p 22523' and notice these timeout issues from child processes that is spawns:
    [pid 22524] read(3, "\n", 1)       
    = 1
    [pid 22524] _llseek(3, 18642588, [18642588], SEEK_SET) = 0
    [pid 22524] read(3, "\0", 1)       
    = 1
    [pid 22524] _llseek(3, 18642589, [18642589], SEEK_SET) = 0
    [pid 22536] <... futex resumed> )  
    = -1 ETIMEDOUT (Connection timed out)
    [pid 22524] read(3,  <unfinished ...>
    [pid 22536] futex(0x972b728, FUTEX_WAKE_PRIVATE, 1) = 0
    [pid 22536] gettimeofday({1384208528, 131781}, NULL) = 0
    [pid 22536] clock_gettime(CLOCK_MONOTONIC, {33657710, 707532536}) = 0
    [pid 22536] gettimeofday({1384208528, 131844}, NULL) = 0
    [pid 22536] clock_gettime(CLOCK_REALTIME, {1384208528, 131892000}) = 0
    [pid 22536] futex(0x965d2bc, FUTEX_WAIT_PRIVATE, 1, {0, 49952000} <unfinished ...>
    My question is does anyone know how i can determine what is causing these timeouts?  It seems the java process spawns off child processes and this is where the timeouts are occurring.  Upon further investigation the child processes are throwing the following errors as well:
    futex(0x905f1b4, FUTEX_WAIT_PRIVATE, 67, NULL) = 0
    futex(0x905ed28, FUTEX_WAKE_PRIVATE, 1) = 0
    futex(0x906345c, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x9063458, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
    futex(0x905f1b4, FUTEX_WAIT_PRIVATE, 69, NULL) = -1 EAGAIN (Resource temporarily unavailable)
    futex(0x905ed28, FUTEX_WAKE_PRIVATE, 1) = 0
    However, I am unable to determine the cause of the timeout and resource issue. Any ideas or help is greatly appreciated! thanks.

    I would suggest you consult "Applaud Solutions" for this issue.
    Thanks,
    Hussein

  • Portal Invalid at the top level of the document.  Error processing resource...

    We installed WebLogic Portal.  We were able to bring up the webpage while we were configured on port 80.  As soon as we wired the portal for port 443, it would not display page.  Error:   Invalid at the top level of the document. Error processing resource...
    We are on a VM with Redhat Linux 5.  Oracle Weblogic portal 10.3.5
    Has anyone had this issue in the past and was able to resolve it?

    Did you upgrade your Portal to 10.1.4? Are you using the Web Cache port # or the HTTP Server port #? You can get this error message if you use the HTTP Server port # on Portal 10.1.4.

  • "No Child Processes" Error

    When I am downloading certain files from the internet, the files are not mounting, and I am getting a "No child Processes" Error. I have run the apple repair disc over the computer, however, the problems is still happening. Can anybody help to me fix this problem???? Thanks

    Hi-
    Welcome to Discussions!
    Is it possible to download what you want from a different server? The error could well be the result of file problems on the other end.
    To further insure that it isn't your system, run a full set of maintenance scripts, and clear logs, caches, and other temporaries.
    A last item to "clear" your machine, would be a restart be fore trying to download.
    Should these proceedures fail to fix the problem, I would consider the problem to be with those "certain files".

  • XML document must have a top level element. Error processing resource

    Hi,
    I am trying to send a XML file to a web browser from a servlet. I read the contents of the XML file into a string and I am sending it to the brower. Before I do this I set the 'Content-type' header of the httpResponse to "application/xml" . Embedded in the XML file is an xml-stylesheet elemetn indicating which *.xsl stylesheet to use to parse the XML content.
    I get the following error:
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://127.0.0.1:8080/testReplyingXML/xml-to-html.xs...
    Now, if I take the stylesheet element out of the XML string I sent, then the browser stores the content into and *.xml file. I manually run the "xml-to-xsl " stylesheet mentioned in the error output above, and there is no problem, the xml content gets successfully transformed in a viewable HTML .
    It is only when I embed the "stylesheet" element into the XML content that I get this error.
    So the browser is receiveing valid XML.
    I am not sure if the above error is complaining about the XML content I send or the stylesshet .
    Does anyone have an idea of what am I doing wrong?
    For your information here are my servlet code and the XML file:
    servlet:-
    package webapps.testReplyingXML;
    import java.io.BufferedReader;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.FileReader;
    import java.util.Enumeration;
    import java.util.StringTokenizer;
    import java.io.PrintWriter;
    public class ReplyXML extends HttpServlet {
              static int transactionCount = 0;
              public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException ,IOException {
                   String Q_PARAM = "query";
                   String requestString = req.getQueryString();
                   for ( Enumeration en = req.getParameterNames() ; en.hasMoreElements() ; )
         String k = (String)en.nextElement() ;
         String[] x = req.getParameterValues(k) ;
         String s = null;
         String DATA_PARAM= "";
         for(int i = 0 ; i < x.length ; i++ )
         s = x[i] ;
         //System.out.println("s = " + s);
         if (k.equals("query")){
              try {
                             //res.setHeader("Content-Type", "application/xml");
                             //res.setHeader("Transfer-Encoding", "chunked");
                             //res.setHeader("Cache-Control", "no-cache");
                             //res.setHeader("Server", "Jetty/5.1.10");
                             //res.setHeader("Pragma", "no-cache");
                             //res.setHeader("X-Joseki-Server", "Joseki-3.0-dev");
                             res.setStatus(res.SC_OK);
                             StringBuffer fileData = new StringBuffer(1000);
                        BufferedReader reader = new BufferedReader(new FileReader("sparql_results.xml"));
                        char[] buf = new char[1024];
                        int numRead=0;
                        while((numRead=reader.read(buf)) != -1){
                        String readData = String.valueOf(buf, 0, numRead);
                        fileData.append(readData);
                        buf = new char[1024];
                        reader.close();
                        String xmlMsg= fileData.toString();
                        System.out.println("XMLMSG= " + xmlMsg);
                             PrintWriter outresp = res.getWriter();
                             outresp.println(xmlMsg);
                             outresp.close();
              }catch (Exception e) {
                   e.printStackTrace();
              public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
                   doGet(req, res);
    XML FILE:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="xml-to-html.xsl"?>
    <sparql
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xs="http://www.w3.org/2001/XMLSchema#"
    xmlns="http://www.w3.org/2005/sparql-results#" >
    <head>
    <variable name="book"/>
    <variable name="title"/>
    </head>
    <results ordered="false" distinct="false">
    <result>
    <binding name="book">
    <uri>http://example.org/book/book6</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Half-Blood Prince</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book5</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Order of the Phoenix</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book4</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Goblet of Fire</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book3</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Prisoner Of Azkaban</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book2</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Chamber of Secrets</literal>
    </binding>
    </result>
    <result>
    <binding name="book">
    <uri>http://example.org/book/book1</uri>
    </binding>
    <binding name="title">
    <literal>Harry Potter and the Philosopher's Stone</literal>
    </binding>
    </result>
    </results>
    </sparql>

    Error processing resource http://127.0.0.1:8080/testReplyingXML/xml-to-html.xs...
    Well, if one more character had been deleted from that message then you would have a problem. But as it is, the error message says there's an error processing a resouce whose name ends with "xml-to-html.xs" followed by something. That would be the stylesheet if I'm not mistaken. Most likely the browser can't find it at the URL mentioned in the error message.

  • Why can not I see the name of a child process?

    Hi,
    I implemented a program for my project.
    My program has two processes. One is a parent process. Another is a child process.
    The parent process forks its child process. The child process is executed by execl() system call.
    The program code implemented is followed.
    === abbreviation ===
    switch(itmr_forkid = fork()) {
    case 0:
    RCode = execl("./itmr", "itmr", (char *) 0);
    exit(0);
    break;
    === abbreviation ===
    I executed the program. And then I pressed "ps -ef" on command line.
    [stp1ggsn1][user/shlim] ps -ef
    UID PID PPID C STIME TTY TIME      CMD
    root 29402 29376 38 Mar 06 pts/0 11376:36 ibgfb
    root 29403 29402 0 Mar 06 pts/0 0:15
    However, why can not I see itmr process name for the child process?
    When I executed the program for the parent process and the program for the child process respectively, I can see itmr process name for the child process.
    I tried to look for the cause. But I could not find out the answer.
    Please, give me your answer. Thank you for your answer in advance.

    Hi,
    I am sorry that I loaded my question two times by mistake.

  • Input and output from child process

    Hi all,
    I am developing an IDE for the Haskell functional programming language. The application runs the Haskell interpreter as child process, and sends and receives input from the interpreter. At the moment I'm programming the integrated console through which the IDE should communicate with the interpreter. The problem is that when I send a command to the interpreter to execute the code I can't detect when the code is running and when it waits for input, so I'll be able to dissable and enable input in the the console respectivly. Please answer as soon as possible, and if my explanation of the problem is not clear enough please just comment about it. Thank you in advance.

    Generally the way I have seen that sort of things designed is like this: You have a script in mind. For example:
    1. Send command "ABC DEF" to the interpreter.
    2. Wait until it responds with "OK" or "Failed".
    3. If it responded with "Failed" then quit.
    4. Send command "XYZ XYZ" to the interpreter.
    5. ... and so on
    You can do this in simple or complicated ways, of course. But if you can't do it, then you're going to find it difficult to do anything at all. For example you won't know when the interpreter is waiting for input (that seems to be your problem already).

  • How to get child process instance id from main process

    Hi All,
    I have a main process invoiking a child process 1 and child process 1 inturn calling child process 2.Is there any way to get the child process 2 instance id from main process or main process instance id from child process 2.. Using tree finder in BPEL Control i can find the direct sub process(child 1) instance id from the main process instance. Is it possible to trace Sub process 2 instance id without going for the instance detail of sub process 1.
    Thanks in advance
    ChitraDevi

    you could easily derive this from the bpel cube_instance table. using cikey and parent_id columns. you can use IInstanceMetaData javadoc, it has method called getParentId( ) to get the id. you can get the root id (instance-id of the main bpel process instance) using getRootId( ). you can checkout this blog.
    http://tech-sash.blogspot.com/2008/04/oracle-soa-suite-retrieving-process.html

  • How can I pass environment variables to the child process?

    How can I pass environment variables to the child process? This is what I tried and it didn't work.
         static public void main (String[] args) throws Exception {
              ProcessBuilder b = new ProcessBuilder("java", "-cp", ".", "Child");
              Map<String, String> map = b.environment();
              map.put("custom.property", "my value");
                 b.redirectErrorStream(true);
              Process p = b.start();
              BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
              String line = null;
              while (null != (line = reader.readLine())) {
                   System.out.println(line);
         public static void main(String[] args) {
              System.out.println("The value of custom.property is : " + System.getProperty("custom.property"));
         }and the result is:
    The value of custom.property is : null

    Complete test:
         static public void main (String[] args) throws Exception {
              ProcessBuilder b = new ProcessBuilder("java", "-Dcustom.property=my property value", "-cp", ".", "Child");
              Map<String, String> map = b.environment();
              map.put("custom.property", "my environment value");
                 b.redirectErrorStream(true);
              Process p = b.start();
              BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
              String line = null;
              while (null != (line = reader.readLine())) {
                   System.out.println(line);
         public static void main(String[] args) {
              System.out.println("Property value of custom.property is : " + System.getProperty("custom.property"));
              System.out.println("Environment value of custom.property is : " + System.getenv("custom.property"));          
         }

  • Child process dies, nfs locks not released, webserver hangs...

    Hi,
    I have Sun One 6.1 sp 11 on a solaris 10 ldom.
    The server is configured to write logs access and error to /logs which is an NFS mount to a separate solaris 10 box. The logging to an NFS mount is a business requirement.
    Sun JWS is configured to have two httpd processes and the watchdog to restart them if one should fail.
    Every now and then, about once a day (it varies), one of the child processes will die with messages like this in the error log: (1949 is the wdog pid)
    [09/Dec/2009:14:19:06] failure ( 1949): CORE3107: Child process closed admin channel
    [09/Dec/2009:14:19:06] fine ( 1949): CORE3061: signal_handler_thread: received signal 18
    [09/Dec/2009:14:19:06] fine ( 1949): CORE3049: Primordial process detected child 1950 died: status 37
    [09/Dec/2009:14:19:06] fine ( 1949): CORE3050: Is our child, will spawn replacement
    [09/Dec/2009:14:19:06] fine ( 1949): CORE3062: Unlinking of /tmp/https-wv2-819e4c2d/.cgistub_1950 returned -1
    [09/Dec/2009:14:19:06] fine ( 1949): CORE3047: Server spawned worker process 2011
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP5169: User authentication cache entries expire in 120 seconds.
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP5170: User authentication cache holds 200 users
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP5171: Up to 4 groups are cached for each cached user.
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP4207: file cache module initialized (API versions 2 through 2)
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP4302: file cache has been initialized
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP3066: MaxKeepAliveConnections set to 256
    [09/Dec/2009:14:19:06] fine ( 2011): Installed configuration 1
    [09/Dec/2009:14:19:06] fine ( 2011): HTTP4193: flex-rotate-init: rotate start time is 0h, 0m
    At this point the webserver will not respond. The processes (2*httpd, 1*wdog) are running but do not respond. The access log shows a weird lock with output from pfiles:
    21: S_IFREG mode:0777 dev:340,10 ino:34988 uid:111 gid:102 size:0
    O_RDWR|O_APPEND|O_CREAT|O_LARGEFILE FD_CLOEXEC
    advisory write lock set by system 0x2 process 280
    which I think means the new http process is waiting for the lock to be released, but the lock is never freed.
    But what I'm really curious about is why the process is dying in the first place. Anyone seen "status 37" before, or know where I can look it up? I couln't google up any reference on what it might mean...
    any help appreciated
    cheers
    Kristin.

    I found the following in http://docs.sun.com/app/docs/doc/816-4555/rfsrefer-134?l=ja&a=view :
    In this situation, the SIGLOST signal is posted to the process. The default action for the SIGLOST signal is to terminate the process.
    For you to recover from this state, you must restart any applications that had files open at the time of the failure. Note that the following can occur.
    - Some processes that did not reopen the file could receive I/O errors.
    - Other processes that did reopen the file, or performed the open operation after the recovery failure, are able to access the file without any problems.
    Thus, some processes can access a particular file while other processes cannot.
    Edited by: Arvind_Srinivasan on Dec 10, 2009 12:33 AM

  • How do I get the PID of a child process in java using JNI?

    I am writing an app in Java (for **nix) that will spawn multiple processes (using Process objects). I want to be able to get the PID for a particular child process (not the parent). How can I do this?

    You could try an extreme hack of using JNI to read whatever field of the java.lang.Process-derived class may hold a native process id. This would be unsupportable beyond the exact JVM(s) you can test it on, and should only be a last resort, but within these constraints it may work well. The source code for package java.lang gives clues of where to start hacking.
    -slj-

  • 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

  • BPEL child process issue

    Problem Description:
    Parent process invoking more than 10 concurrent child processes with non-blocking invoke = true. All the child processes are not invoked at
    the same time. Some of the child processes are waiting for others to complete and then invoked. Sometimes all the child processes(tested till
    100 child processes) are invoked at same time and when tested immediately for the next time it executes in different timings. Say for
    example, if I invoke 90 child processes then executes like 83+7.
    Parent process time – 3 mins(set)
    Child process execution time – 2 mins
    So the parent will be alive for 3 mins and the first set of child processes gets created and dies after 2 mins and then the next set of child processes starts(i.e. in the 2nd min of parent) and does not execute completely as the parent dies after 1 min from the time of second set of child creation.
    The parent process “Times Out” while waiting for response from the child processes.
    We have similar environment which does not behave in this way, all the processes are executed in 1 single batch.
    BPEL version: 10.1.3.3.0
    BPEL server is on top of WAS 6.1.
    "Maximum batch size" is 1.
    Thread pool size of webcontainer is min-10, max-50.
    Please let me know how to fix this issue.
    Thanks,

    http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28980/bpel_install.htm
    look at section 2.11.1

Maybe you are looking for

  • WEB u2013 I cache issue.

    We have BO XI 3.1 PF 1.7 and SAP BW 7.0 SP 18 We are facing strong caching issue  with WEB- I XI 3.1 , what we observed is it cache previously fetched data and does not recognize data been updated in BW Infoprovider ( in our case we have BEx query on

  • Stock in transit visibility

    Hi all, I am working on the following gap for my client How to have stock in transit visibility when finished goods  are exported to another client site. Suggested solution is to do some custom for ATD receipts/issues for restricted/unrestricted and

  • Status of the project

    Hi all, How to check the status of an Implementation Project? One of my friend faced the question in an interview. Please respond. Regards, Sudhakar.

  • Microsoft Publisher 2007

    Microsoft Publisher 2007 - I know I know, why am I using Microsoft publisher 2007.  I work for a pre-school and this is all they have and I am creating monthly newsletter templates for them. Anyways. I am trying to change the color of text and when I

  • Trying to access itunes library on new computer; old computer destroyed.

    I have a new computer after my old one was destroyed. I have an ipod classic and 2 shuffles. Can not access a library for any of them. You would think Ipod would help with this situation, but I have not found it yet. Any suggestions?