https://bz.apache.org/bugzilla/show_bug.cgi?id=61817

            Bug ID: 61817
           Summary: ap_get_exec_line() creates defunct/zombie process
           Product: Apache httpd-2
           Version: 2.4.29
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_authz_ldap
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 35555
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35555&action=edit
patch to server/util.c (ap_get_exec_line)

ap_get_exec_line() calls apr_file_close(), but it is not enough to terminate
the child process; it should call apr_proc_wait().
I'll attach a patch.

This will occur only when we use
AuthLDAPBindPassword exec:/path/to/command/to/echo/password
directive. Thus it is difficult to reproduce.

So I checked my patch with customized server/log.c.
I added last two lines.

void ap_logs_child_init(apr_pool_t *p, server_rec *s)
{
    read_handle_t *cur = read_handles;

    while (cur) {
        apr_file_close(cur->handle);
        cur = cur->next;
    }
    const char *argv[] = {"dummyXXXX"};  /* added for test */
    ap_get_exec_line(p, "/bin/mktemp", argv);  /* added for test */
}

We can easily see defunct mktemp without patch. With patch, we don't see.

% ./apachectl start
% ps aux | grep Z
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
me       19398  0.0  0.0      0     0 ?        Z    14:42   0:00 [mktemp]
<defunct>
me       19399  0.0  0.0      0     0 ?        Z    14:42   0:00 [mktemp]
<defunct>
me       19400  0.0  0.0      0     0 ?        Z    14:42   0:00 [mktemp]
<defunct>
me       19485  0.0  0.0  14860  2184 pts/3    S+   14:42   0:00 grep
--color=auto Z

NOTE: Sorry, argv have no effect. I may misunderstand how to use argv.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to