Bug 57101 - [PATCH] Better error reporting when child spawn fails
Summary: [PATCH] Better error reporting when child spawn fails
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_fcgid (show other bugs)
Version: 2.4.9
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2014-10-16 20:48 UTC by lluismh
Modified: 2018-08-22 19:58 UTC (History)
0 users

Patch that improves error reporting (2.89 KB, patch)
2014-10-16 20:48 UTC, lluismh
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lluismh 2014-10-16 20:48:03 UTC
Created attachment 32118 [details]
Patch that improves error reporting

The child process is created in "proc_spawn_process()" using "apr_proc_create()" and the spawn is considered successful if the return code is APR_SUCCESS. apr_proc_create() returns as soon as the child is forked and does not report an error if the execv calls fail. For instance if apr_proc_crate() can't find the executable to spawn it still returns APR_SUCCESS, and no information is recorded in the logs to assist in debugging of issues.

apr_proc_create() uses a callback (set through "apr_procattr_child_errfn_set()") to report process spawn failures. This simple patch adds an error-reporting callback that reports through a logfile the errors, easing troubleshooting of mod_fcgid spawn issues. 

This is an example log entry that is recorded through the changes introduced in the patch:

[Thu Oct 16 16:21:11 2014] [error] (2)No such file or directory: mod_fcgid: error spawning process: exec of '/usr/lib/apache2/suexec' failed

I hope it is as useful to you as it was to us when troubeshooting a chroot+mod_fcgid+suexec setup.