From: mpcribeiro at yahoo dot com Operating system: Solaris 10 PHP version: 5.1.6 PHP Bug Type: Scripting Engine problem Bug description: Memory Leak
Description: ------------ PHP 5.1.6 compiled and installed without issues. However when procedures call sybase functions and after few minutes. PHP complain with not enough memory. PHP seem unable to read all the script, also unable to address the variables properly. At beggining gave "fatal errors" due to lack of memory even with 200Mb has memory limit (raised from its default value). After recompiling php 5.1.6 for 2nd time, I'm now getting the following errors, and lack of memory (200mb limit) message is now rare to appear. Warning: Unknown list entry type in request shutdown (0) in lib/lib_syb_sessions.php on line 61 Warning: Unknown list entry type in request shutdown (0) in /lib/lib_syb_sessions.php on line 42 PHP 5.1.6 was compiled with the following parameters: PHPHOME=/opt/php APACHEHOME=/opt/apache cat /dev/null > conf.log export PATH=$PATH:/var/MailRoot/bin ./configure --prefix=$PHPHOME \ --bindir=$PHPHOME/bin \ --libdir=$PHPHOME/lib \ --with-config-file-path=$PHPHOME/conf \ --with-apache2=$APACHEHOME/ \ --with-apxs2=$APACHEHOME/bin/apxs \ --with-sfw=/usr/sfw \ --with-jpeg \ --with-jpeg-dir=/usr/local \ --with-png \ --with-png-dir=/usr/local \ --with-ftp \ --with-zlib-dir=/usr/local \ --enable-magic-quotes \ --enable-safe-mode \ --enable-sockets \ --enable-track-vars \ --enable-trans-sid \ --enable-memory-limit \ --enable-calendar \ --with-pgsql=/opt/pgsql \ --with-mysql-dir=/opt/mysql \ --with-sybase-ct=$SYBASE/$SYBASE_OCS \ --enable-static=sybase-ct \ --enable-mbstring I have reviewed the procedure few times and I can't find any glitch that could cause such behaviour. I'm now compiling the latest 5.2* from dev's cvs to see if this issue is solved. Cheers Reproduce code: --------------- function syb_list_processes($DBase,$DBusr,$DBpwd,$SID,$SN,$SYBSN,$ORDER) { putenv("SYBASE=/opt/sybase"); putenv("SYBPLATFORM=solaris"); putenv("LC_ALL=default"); putenv("DSQUERY=SYBASE"); $lg=read_session_id($SID,'login'); if(!$ORDER) { $ORDER='suid'; } $SYBusr=syb_get_sadetails($DBase,$DBusr,$DBpwd,$SN,$SYBSN,'sausr'); $SYBpwd=syb_get_sadetails($DBase,$DBusr,$DBpwd,$SN,$SYBSN,'sapwd'); [EMAIL PROTECTED]("$SYBSN","$SYBusr","$SYBpwd"); if($ORDER=="") { $ORDER='suid'; } switch ($ORDER) { case 'cpu': $SORTORDER="DESC"; break; case 'physical_io': $SORTORDER="DESC"; break; case 'memusage': $SORTORDER="DESC"; break; case 'cmd': $SORTORDER="DESC"; break; default: $SORTORDER=""; break; } $string="SELECT * FROM sysprocesses WHERE program_name NOT LIKE 'PHP %' ORDER BY $ORDER $SORTORDER"; $sybres=sybase_query($string); if($sybres) { $flag=0; [EMAIL PROTECTED]($sybres); printf("NROWS=%s",$NROWS); printf("<TABLE width=760>"); printf("<TR><TD><B>No. Procs</B></TD><TD><FONT color=blue>%s</FO NT></TD></TR>",$NROWS); printf("<TR BGCOLOR='darkgrey'> <TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=spid'><B>SPID</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=status'><B>Status</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=suid'><B>User</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=dbid'><B>Database</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=cmd'><B>CMD</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=cpu'><B>CPU</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=physical_io'><B>I/O</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=memusage'><B>RAM</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=clienthostname'><B>Hostname</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=program_name'><B>Program</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD><A HREF='syb_procs_lst.php?sid=%s&server=%s&sybserve r=%s&order=ipaddr'><B>IP</B></A></TD>",$SID,$SN,$SYBSN); printf("<TD></TD>"); printf("</TR>"); for ($i=0; $i < $NROWS; $i++) { [EMAIL PROTECTED]($sybres,$i,0); [EMAIL PROTECTED]($sybres,$i,3); [EMAIL PROTECTED]($sybres,$i,5); [EMAIL PROTECTED]($sybres,$i,29); [EMAIL PROTECTED]($sybres,$i,6); [EMAIL PROTECTED]($sybres,$i,8); [EMAIL PROTECTED]($sybres,$i,13); [EMAIL PROTECTED]($sybres,$i,34); [EMAIL PROTECTED]($sybres,$i,9); [EMAIL PROTECTED]($sybres,$i,10); [EMAIL PROTECTED]($sybres,$i,11); switch (trim($SYBSTATUS,' ')) { case "running": $COLOR='green'; break; default: $COLOR='black'; break; } if($flag==0) { printf("<TR> <TD><A HREF='processes3.php?SN=%s&SPID=% s&lg=%s&pw=%s'><FONT SIZE=0>%s</FONT></A></TD>",$SN,$SYBSPID,$lg,$pw,$SYBSPID); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBSTATUS); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,syb_get_login($DBase,$DBusr,$DBpwd,$SN,$SYBSN,$SYBSUID)); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,syb_get_database($DBase,$DBusr,$DBpwd,$SN,$SYBSN,$SYBDB)); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBCMD); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBCPU); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBIO); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBMEM); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBHOST); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBPRG); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ",$COLOR,$SYBIP); if($lg<>"demo") { printf(" <TD><A HREF='killprocess.php?SN =%s&SPID=%s&lg=%s&pw=%s'><IMG SRC=img/disable.gif width=10 height=10 border=0 ti tle='Kill Process'></A></TD>",$SN,$SYBSPID,$lg,$pw); } else { printf(" <TD><IMG SRC=img/disable.gif wi dth=10 height=10 border=0 title='Kill Process'></TD>"); } printf("</TR>"); $flag++; } else { printf("<TR BGCOLOR='lightgrey'> <TD><A HREF='processes3.php?SN=%s&SPID=% s&lg=%s&pw=%s'><FONT SIZE=0>%s</FONT></A></TD>",$SN,$SYBSPID,$lg,$pw,$SYBSPID); printf("<TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> <TD><FONT SIZE=0 COLOR=%s>%s</FONT></TD> ", $COLOR,$SYBSTATUS, $COLOR,syb_get_login($DBase,$DBusr,$DBpw d,$SN,$SYBSN,$SYBSUID), $COLOR,syb_get_database($DBase,$DBusr,$D Bpwd,$SN,$SYBSN,$SYBDB), $COLOR,$SYBCMD, $COLOR,$SYBCPU, $COLOR,$SYBIO, $COLOR,$SYBMEM, $COLOR,$SYBHOST, $COLOR,$SYBPRG, $COLOR,$SYBIP); if($lg<>"demo") { printf(" <TD><A HREF='killprocess.php?SN =%s&SPID=%s&lg=%s&pw=%s'><IMG SRC=img/disable.gif width=10 height=10 border=0 ti tle='Kill Process'></A></TD>",$SN,$SYBSPID,$lg,$pw); } else { printf(" <TD><IMG SRC=img/disable.gif wi dth=10 height=10 border=0 title='Kill Process'></TD>"); } printf("</TR>"); $flag=0; } } } printf("</TABLE>"); @sybase_close($connect); } Expected result: ---------------- No fatal errors with lack of memory (im now using 200Mb) where in previous versions I used the default value. The variables showing the correct content (not empty content or values mixed between vars). -- Edit bug report at http://bugs.php.net/?id=39058&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39058&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39058&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39058&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39058&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39058&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39058&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39058&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39058&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39058&r=support Expected behavior: http://bugs.php.net/fix.php?id=39058&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39058&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39058&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39058&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39058&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39058&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39058&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39058&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39058&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39058&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39058&r=mysqlcfg