JDK-4889975 : (process) [1.3.1_06] SIGABORT occurs when Runtime.exec() invokes child process
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.3.1_06
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2003-07-14
  • Updated: 2006-01-30
  • Resolved: 2006-01-30
Related Reports
Relates :  
Description
A licensee found the core when the program creates child process in
Runtime.exec().
The crash frequency is once a month in 24 hours run on multi processor
box.(4 CPU)

The crash(SIGABORT) occurs in "close()" called from 
java/lang/UNIXprocess#forkAndExec and some message of libthread panic
is output.

We will get more details later. 
The attache in below are their investigation.


INVESTIGATION:

 There seems a problem in 
   j2se/src/solaris/native/java/loang/UNIXProcess_md.c.solaris
 specifically, the problem may be in the lines which try to close()
 file desciptor after fork1().
 
===  UNIXProcess_md.c.solaris 1.3.1_0X ====

   .....

    resultPid = fork1();

    .......

    if (resultPid == 0) {
        /* Child process */
        int i, max_fd;

   .......

        /* close everything */
        max_fd = sysconf(_SC_OPEN_MAX);
        for (i = 3; i < max_fd; i++) close(i);    //  (*1), may have problem

   ......

        execvp(cmdv[0], cmdv);

        _exit(-1);
    }



<=======

They consider the above (*1) part should be as follows.

=======>
   .....

    resultPid = fork1();

    .......

    if (resultPid == 0) {
        /* Child process */
        int i, max_fd;

   .......

        /* close everything */
        max_fd = sysconf(_SC_OPEN_MAX);

       for (i = 3; i < max_fd; i++) {       // change
         int flags = fcntl(i, F_GETFD);     // change
         if(flags >= 0) {                   // change
           flags |= FD_CLOEXEC;             // change
           fcntl(i, F_SETFD, flags);        // change
         }                                  // change
       }                                    // change

   ......

        execvp(cmdv[0], cmdv);

        _exit(-1);
    }


<=======


NOTE:
  According to their investigation, when the following occurs in libthread
  in  Solaris7 106980-12 or later, the program outputs core files.
    - To fail in creating lwp because of the short of resources( ex. mem) 
    - application program close(2)s fd whcih libthread open(2)  
 
==========================================================================

Comments
EVALUATION Closing as Not Reproducible -- no reproducible test case was provided.
30-01-2006

PUBLIC COMMENTS -
04-09-2004

EVALUATION (Note: the Linux code and Solaris code have recently been unified into UNIXProcess_md.c) It is a standard technique on a Unix system to fork(), close most file descriptors, then exec(). If this causes a SIGABORT, then this is a bug in the operating system. Although it is wise to make more liberal use of FD_CLOEXEC for other reasons, this should not be necessary. In any case, using FD_CLOEXEC is just a "delayed" close -- there is no reason why this should avert a SIGABORT from close(). If we had a reproducible test case, we could give this to the Solaris folks to fix. Since we don't, this should be closed as not a bug (at least, not OUR bug). ###@###.### 2003-07-15 I intend to close this soon, unless a reproducible test case is made available. I believe there is no bug in the Process-handling code that could cause a crash in the manner described. ###@###.### 2003-10-23
23-10-2003