Bug#491500: tomcat5.5: keeps open file descriptors for the terminal

Robert Fitzsimons robfitz at 273k.net
Fri Dec 12 15:29:26 UTC 2008


I've also got caught by this problem which causes ssh sessions to fail
to close and tomcat restart's to hang ant build scripts.

The problem seems to be in the Debian specific patch to jsvc which added
support for redirecting stdout/stderr output to syslog.  That patch
doesn't close the parent processes stdout/stderr files after detaching.
The following proof-of-concept patch against the latest lenny version of
jsvc, will reopen the stdout/stderr to '/dev/null' before creating the
pipes.

Robert


diff -r -u commons-daemon-1.0.2~svn20061127.old/src/native/unix/native/jsvc-unix.c commons-daemon-1.0.2~svn20061127.new/src/native/unix/native/jsvc-unix.c
--- commons-daemon-1.0.2~svn20061127.old/src/native/unix/native/jsvc-unix.c 2008-12-12 15:17:38.000000000 +0000
+++ commons-daemon-1.0.2~svn20061127.new/src/native/unix/native/jsvc-unix.c 2008-12-12 14:30:58.000000000 +0000
@@ -692,6 +692,7 @@
     }
 
     if (strcmp(outfile, "SYSLOG") == 0) {
+        freopen("/dev/null", "a", stdout);
         /* Send stdout to syslog through a logger process */
         if (pipe(out_pipe) == -1) {
             log_error("cannot create stdout pipe: %s",
@@ -704,6 +705,7 @@
     }
 
     if (strcmp(errfile, "SYSLOG") == 0) {
+        freopen("/dev/null", "a", stderr);
         /* Send stderr to syslog through a logger process */
         if (pipe(err_pipe) == -1) {
             log_error("cannot create stderr pipe: %s",






More information about the pkg-java-maintainers mailing list