Bug 55070 - mod_fcgid stderr always goes to main error log
Summary: mod_fcgid stderr always goes to main error log
Status: REOPENED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_fcgid (show other bugs)
Version: 2.4.4
Hardware: PC Linux
: P2 enhancement with 3 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-06 21:09 UTC by jan
Modified: 2013-09-01 22:19 UTC (History)
1 user (show)



Attachments
A patch to redirect stderr of processes spawned by mod_fcgid to the vhost's error log (4.88 KB, patch)
2013-08-26 11:50 UTC, Jan-Oliver Kaiser
Details | Diff
fixed a bug in the patch (4.71 KB, text/plain)
2013-09-01 22:19 UTC, Jan-Oliver Kaiser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jan 2013-06-06 21:09:30 UTC
mod_fcgid does not listen to per vhosts errorlog directive
mod_fcgid loggs to apache error_log using his own format or more exacly complete lack of it:

Cannot load the ionCube PHP Loader - it was built with configuration 2.2.0, whereas running engine is API220090626,NTS
Zend Optimizer requires Zend Engine API version 220060519.
The Zend Engine API version 220090626 which is installed, is newer.
Contact Zend Technologies at http://www.zend.com/ for a later version of Zend Optimizer.

No date, no identification of process, virtualhost, directives. Full wtf.

mod_fcgid logs without any regard for LogLevel.

mod_fcgid spams apache error_log and should not log to it as it is.
Comment 1 Eric Covener 2013-06-06 21:26:21 UTC
ioncube PHP loader is writing to stderr.  stderr is sent to the main error log.
Comment 2 jan 2013-06-06 21:28:23 UTC
Then I guess stderr should not be send to main apache error_log by mod_fcgid
Comment 3 jan 2013-06-06 21:29:12 UTC
Then I guess stderr should not be send to main apache error_log by mod_fcgid - especialy without any formating - date, time, identification
Comment 4 Eric Covener 2013-06-06 21:44:39 UTC
Marking as an enhancement, processes kicked off from fcgid could have their stderr redirected or wrapped by some pipe and related back to some config directive, but not IMO a bug.
Comment 5 Jan-Oliver Kaiser 2013-08-26 11:50:33 UTC
Created attachment 30763 [details]
A patch to redirect stderr of processes spawned by mod_fcgid to the vhost's error log

The attached patch was tested with mod_fcgid 2.3.7 and apache 2.2.25. It should be simple enough to adapt to newer versions, if necessary at all. It does not wrap the output in any way. Also note that it depends on the order of vhosts at initialization. If any module changes that order, this patch will not write to the correct error log.
Comment 6 Eric Covener 2013-08-26 12:31:22 UTC
Comment on attachment 30763 [details]
A patch to redirect stderr of processes spawned by mod_fcgid to the vhost's error log

Can a FCGI app handle requests only on the VH that started it?
Comment 7 Jan-Oliver Kaiser 2013-08-26 14:03:00 UTC
(In reply to Eric Covener from comment #6)
> Can a FCGI app handle requests only on the VH that started it?

As far as I can tell, fcgid_bridge.c:62 should prevent that from happening. No running process with vhost_id different from the request's vhost_id is ever taken into consideration.
Comment 8 Jan-Oliver Kaiser 2013-09-01 22:19:25 UTC
Created attachment 30791 [details]
fixed a bug in the patch

This is a new version of the patch, which fixes a off-by-one error in the previous version. Sadly, I also learned that the patch only works when all virtual hosts have at least one Fcgid* directive in their configuration. Otherwise, the vhost_id of main_server will be used for requests and, thus, errors will be written to the main error log.