#754702 libapache2-mod-perl2: Apache2 "comm" field in /proc/[pid]/stat is changed to full path when mod_perl is enabled

Package:
libapache2-mod-perl2
Source:
libapache2-mod-perl2
Description:
Integration of perl with the Apache2 web server
Submitter:
Frank Fegert
Date:
2015-01-07 16:51:09 UTC
Severity:
minor
#754702#5
Date:
2014-07-13 13:49:23 UTC
From:
To:
Hello,

when enabling mod_perl, the "comm" field in /proc/[pid]/stat of the Apache2
processes is changed to the full path of the Apache2 executable and subsequently
truncated to 15+NUL characters. Probably not an issue by itself, but i breaks
e.g. monitoring tools like Nagios/NRPE which look at the process name either
directly in /proc/[pid]/stat or through commands like "ps".

Example without mod_perl:

    # service apache2 stop
    [ ok ] Stopping web server: apache2 ... waiting .
    # a2dismod perl
    Module perl disabled.
    To activate the new configuration, you need to run:
      service apache2 restart
    # service apache2 start
    [ ok ] Starting web server: apache2.
    # ps -ef | grep apache2
    root      8196     1  0 15:20 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8199  8196  0 15:20 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8200  8196  0 15:20 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8201  8196  0 15:20 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8202  8196  0 15:20 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8203  8196  0 15:20 ?        00:00:00 /usr/sbin/apache2 -k start
    # cat /proc/8{1,2}{9,0}*/stat
    8196 (apache2) S 1 8196 8196 0 -1 4202560 [...]
    8199 (apache2) S 8196 8196 8196 0 -1 4202816 [...]
    8200 (apache2) S 8196 8196 8196 0 -1 4202816 [...]
    8201 (apache2) S 8196 8196 8196 0 -1 4202816 [...]
    8202 (apache2) S 8196 8196 8196 0 -1 4202816 [...]
    8203 (apache2) S 8196 8196 8196 0 -1 4202816 [...]

Example with mod_perl:

    # service apache2 stop
    [ ok ] Stopping web server: apache2 ... waiting .
    # a2enmod perl
    Enabling module perl.
    To activate the new configuration, you need to run:
      service apache2 restart
    # service apache2 start
    [ ok ] Starting web server: apache2.
    # ps -ef | grep apache2
    root      8291     1  0 15:21 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8296  8291  0 15:21 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8297  8291  0 15:21 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8298  8291  0 15:21 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8299  8291  0 15:21 ?        00:00:00 /usr/sbin/apache2 -k start
    www-data  8300  8291  0 15:21 ?        00:00:00 /usr/sbin/apache2 -k start
    # cat /proc/8{2,3}{9,0}*/stat
    8291 (/usr/sbin/apach) S 1 8291 8291 0 -1 4202560 [...]
    8296 (/usr/sbin/apach) S 8291 8291 8291 0 -1 4202816 [...]
    8297 (/usr/sbin/apach) S 8291 8291 8291 0 -1 4202816 [...]
    8298 (/usr/sbin/apach) S 8291 8291 8291 0 -1 4202816 [...]
    8299 (/usr/sbin/apach) S 8291 8291 8291 0 -1 4202816 [...]
    8300 (/usr/sbin/apach) S 8291 8291 8291 0 -1 4202816 [...]

Since i can't assess the implications, could you please consider adopting this
patch: https://bugzilla.redhat.com/attachment.cgi?id=567625&action=diff

Thanks & best regards,

Frank Fegert
-------------8<---------- End Bug Report --------------8<----------

#754702#12
Date:
2014-09-04 20:16:12 UTC
From:
To:
-=| Frank Fegert, 13.07.2014 15:49:23 +0200 |=-

-     modperl_config_srv_argv_push(s->process->argv[0]);
+     modperl_config_srv_argv_push(s->process->short_name);

Seems good, but breaks tests. FindBin complains that it cannot find
"apache2". And if the line is commented another test fails since
FindBin cannot find "-wT" executable (probably coming from "perl
-wT").

This might as well be a bug in FindBin. Right?