Bug 525206

Summary: php-snmp leaks memory on httpd restart
Product: Red Hat Enterprise Linux 5 Reporter: Issue Tracker <tao>
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED WONTFIX QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4CC: ddumas, jwest, mpoole, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-17 17:52:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Issue Tracker 2009-09-23 16:29:11 UTC
Escalated to Bugzilla from IssueTracker

Comment 1 Issue Tracker 2009-09-23 16:29:13 UTC
Event posted on 2009-09-23 08:17 BST by nbansal

Description of problem:

Apache memory usage increases with each Apache reload when php-snmp is installed. Customer is reloading apache every five minutes. The specific reason Apache is getting reloaded every five minutes is to update the list of virtual servers found in httpd-vhosts.conf.

Packages I used to reproduce it:

httpd-2.2.3-31.el5
php-snmp-5.1.6-23.2.el5_3

In the output of watch "ps aux| grep httpd" increment in memory utilization is visible:



Every 2.0s: ps aux | grep httpd                                                                                                                          Wed Sep 23 03:07:20 2009

root	  9651  1.0  7.8 230444 20616 ?        Ss   03:04   0:01 /usr/sbin/httpd
apache    9919  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9920  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9921  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9922  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9923  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9924  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9925  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9926  0.0  5.9 230444 15776 ?        S    03:07   0:00 /usr/sbin/httpd

Every 2.0s: ps aux | grep httpd                                                                                                                          Wed Sep 23 03:07:33 2009

root	  9651  1.1  8.6 232492 22748 ?        Ss   03:04   0:01 /usr/sbin/httpd
root      9927  0.4  0.4  63576  1152 pts/1    S+   03:07   0:00 watch ps aux | grep httpd
apache    9987  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9988  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9989  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9990  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9991  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9992  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9993  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd
apache    9994  0.0  6.8 232492 17900 ?        S    03:07   0:00 /usr/sbin/httpd


When all the memory is consumed apache starts to print following messages in error log:

[Mon Sep 21 10:47:01 2009] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Sep 21 10:47:07 2009] [error] (12)Cannot allocate memory: fork: Unable to fork new process


If we uninstall php-snmp then memory utilization remains constant.  Found following bug but no sure if its related:

http://bugs.php.net/bug.php?id=45405


How reproducible:
Always.

Steps to Reproduce:
1. yum install httpd php-snmp php
2. service httpd start
3. while : ; do sudo /etc/init.d/httpd reload;sleep 5 ; done
4. watch "ps aux | grep httpd"

Actual results:
All the memory in system is consumed when performing frequent httpd reloads.


Expected results:
Memory utilization should remain stable.

Additional info:
Attaching sysreport (10-sosreport-efox.1947864-463633-587a75.tar.bz2) and tar of /etc/httpd ( 20-httpd_conf.tar.bz2 )

Test machine where I reproduced it:

10.65.211.34  root/redhat


This event sent from IssueTracker by mpoole  [Support Engineering Group]
 issue 345827

Comment 2 Martin Poole 2009-09-23 16:52:07 UTC
After a visual review of the ext/snmp/snmp.c file would appear to be due to a lack of shutdown function to call the net-snmp snmp_shutdown() function.

The current upstream code contains a PHP_MSHUTDOWN_FUNCTION function which does call the snmp_shutdown() routine, but my attempts to patch the current RHEL version all fail to compile due to my unfamiliarity with the requirements in patching php source.

Comment 3 Joe Orton 2009-09-28 13:00:13 UTC
In fact we patch out the call to snmp_shutdown(), as a workaround for bug 153988.

If you remove the "%patch22 ..." line -snmp will call snmp_shutdown().  Can you try a test package like that?

Comment 7 Jeremy West 2012-01-17 17:52:09 UTC
I'm closing this bug out since it's been several years since the last bit of feedback provided on this.  If additional feedback is available, please feel free to reopen this bug and continue the conversation.