system() function returns an error ECHILD on execution of a oracle client based program on RHEL-5

Solution Verified - Updated -

Issue

The following information has been provided by Red Hat, but is outside the scope of the posted Service Level Agreements and support procedures. The information is provided as-is and any configuration settings or installed applications made from the information in this article could make the Operating System unsupported by Red Hat Global Support Services. The intent of this article is to provide information to accomplish the system's needs. Use of the information in this article at the user's own risk.

Issue

  • system() function returns an error ECHILD on execution of a oracle client based program on Red Hat Enterprise Linux 5
  • The same program behaves correctly on Red Hat Enterprise Linux 4

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 4
  • Oracle 11.2g database client

Resolution

  • Add the clause "bequeath_detach=true" in sqlnet.ora
  • Check with Oracle support for additional questions regarding this resolution

Root Cause

  • The oracle client library 11.2g modifies the SIGCHLD handler and adds SA_NOCLDWAIT to the sa_flags for the signal. The effect of this is that any child process end thereafter does not result in a zombie process and any wait() or waitpid() call returns in an ECHILD.
  • This behaviour new in oracle 11.2g and is not present in oracle 10.2g

Diagnostic Steps

The sample program below demonstrates the system() function behaviour in the presence of the SA_NOCLDWAIT flag:

#include <signal.h>
#include <stdio.h>

int main()
{
        struct sigaction dfl;
        sigset_t set;
        sigset_t oset;

        sigemptyset(&set);
        sigaddset(&set, SIGCHLD);

        dfl.sa_handler  = SIG_DFL;
        dfl.sa_flags    = SA_RESTART|SA_SIGINFO|SA_NOCLDWAIT;

        if (system("echo 1")<0)
                perror("system return1");

        sigprocmask(SIG_BLOCK, &set, NULL);
        sigaction(SIGCHLD, &dfl, NULL);
        sigprocmask(SIG_UNBLOCK, &set, NULL);

        if (system("echo 2") < 0)
                perror("system return2");
}

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content