Bug 55790 - mod_fcgid lockfile hardcoded to be in /tmp
Summary: mod_fcgid lockfile hardcoded to be in /tmp
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_fcgid (show other bugs)
Version: 2.2.25
Hardware: PC FreeBSD
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2013-11-17 22:06 UTC by krichy
Modified: 2017-12-08 10:33 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description krichy 2013-11-17 22:06:19 UTC
In freebsd, apr chooses to use APR_USE_FLOCK_SERIALIZE, which effectively makes use of files for locking. Unfortunately, mod_fcgid uses tmpnam() for filename creation, which creates a file in the defined P_tmpdir (/tmp). And meanwhile, my system periodically cleans /tmp as well, sometimes removing such lockfiles, and when the httpd processes are restarted, the lock initialization fails, and actually apache stops responding.

Either mod_fcgid should be configurable to use other lockfile-s, or apr should choose another locking method on freebsd.
Comment 1 Mario 2017-12-07 22:33:09 UTC
is this still relevant? On Linux it uses the log folder from apache.

modules/fcgid/fcgid_mutex_unix.c:117:    lockfile = apr_palloc(pconf, L_tmpnam);
modules/fcgid/fcgid_mutex_unix.c:118:    tmpnam(lockfile);

srclib/apr/file_io/unix/tempdir.c:62:          P_tmpdir      (POSIX define)
srclib/apr/file_io/unix/tempdir.c:104:#ifdef P_tmpdir
srclib/apr/file_io/unix/tempdir.c:109:    if (test_tempdir(P_tmpdir, p)) {
srclib/apr/file_io/unix/tempdir.c:110:        dir = P_tmpdir;

From line 50

    /* Our goal is to find a temporary directory suitable for writing
       Here's the order in which we'll try various paths:

          "C:\TEMP"     (windows only)
          "SYS:\TMP"    (netware only)
          P_tmpdir      (POSIX define)

       NOTE: This algorithm is basically the same one used by Python
       2.2's tempfile.py module.  */

    /* Try the environment first. */
Comment 2 Joe Orton 2017-12-08 10:33:59 UTC
That code is specific to 2.2, with 2.4 you can configure it using Mutex:


"Mutex fcgid-pipe ..." and "Mutex fcgid-proctbl ..."