Bug 1876525 - mod_fcgid does not pass more than 64 variables to an FCGI server process environment
Summary: mod_fcgid does not pass more than 64 variables to an FCGI server process envi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: mod_fcgid
Version: 8.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.4
Assignee: Luboš Uhliarik
QA Contact: icesalov
Lenka Špačková
URL:
Whiteboard:
Depends On:
Blocks: 1958882
TreeView+ depends on / blocked
 
Reported: 2020-09-07 11:59 UTC by Petr Pisar
Modified: 2021-05-18 15:54 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
.The `mod_fcgid` module can now pass up to 1024 environment variables to an FCGI server process With this update, the `mod_fcgid` module for the Apache HTTP Server can pass up to 1024 environment variables to a FastCGI (FCGI) server process. The previous limit of 64 environment variables could cause applications running on the FCGI server to malfunction.
Clone Of:
: 1958882 (view as bug list)
Environment:
Last Closed: 2021-05-18 15:53:56 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sclorg dancer-ex issues 78 0 None closed Incompatible with ubi8 perl images 2021-02-08 15:15:12 UTC
Red Hat Product Errata RHBA-2021:1880 0 None None None 2021-05-18 15:54:00 UTC

Description Petr Pisar 2020-09-07 11:59:06 UTC
An OpenShift user noticed <https://github.com/sclorg/dancer-ex/issues/78#issuecomment-687849728> that mod_fcgid does not pass more than 64 environment variables into an FCGI server process. As a result an application running in the FCGI server is missing the variables and misbehaves:

[Sun Sep 06 17:28:04.722760 2020] [fcgid:warn] [pid 18:tid 281472258011088] [client 10.131.0.1:52618] mod_fcgid: 150 environment variables dropped; increase INITENV_CNT in fcgid_pm.h from 64 to at least 214
Can't locate Plack/Runner.pm in @INC (you may need to install the Plack::Runner module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /opt/app-root/src/extlib/bin/plackup line 3.
BEGIN failed--compilation aborted at /opt/app-root/src/extlib/bin/plackup line 3.
[Sun Sep 06 17:28:04.733448 2020] [fcgid:warn] [pid 18:tid 281472258011088] (104)Connection reset by peer: [client 10.131.0.1:52618] mod_fcgid: error reading data from FastCGI server
[Sun Sep 06 17:28:04.733551 2020] [core:error] [pid 18:tid 281472258011088] [client 10.131.0.1:52618] End of script output before headers: health

See the first line. The user needs in this case to increase the limit to 214. I'm not sure what's the reasonable number, but I propose increasing it to 1024. The limit is built into a mod_fcgid httpd module. The fix needs patching mod_fcgid sources (INITENV_CNT macro in modules/fcgid/fcgid_conf.h).

You can adapt a reproducer from bug #1651310. But this time place more than 64 distinct FcgidInitialEnv directives to a mod_fcgid configuration and then compare them with the environment of the running FCGI server process.

Comment 1 Yaakov Selkowitz 2020-09-07 18:10:51 UTC
The 200+ variables were a result of attempting to deploy dancer-mysql-example template in a project in which other samples had been deployed (for general testing).  Retesting in a clean OpenShift project show 57 environment variables present.  So this does work right now, but requiring a pristine project isn't optimal, and there isn't much room for future environment growth either.

The patch which enabled longer environment variable values mentioned a cost in terms of struct size.  What would be the cost of significantly increasing INITENV_CNT?

Comment 2 Petr Pisar 2020-09-08 06:10:48 UTC
Each variable occupies 320 bytes. Increasing the number of variables from 64 to 1024 would mean 307200 B more memory used by each FCGI server process.

Comment 22 errata-xmlrpc 2021-05-18 15:53:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (mod_fcgid bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1880


Note You need to log in before you can comment on or make changes to this bug.