[PHP] Re: Segmentation fault in php5-imap
Perhaps compile everything in debug versions and get some core dumps and file a bug report at http://bugs.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Segmentation fault in php5-imap
I just tried closing the message box and reopeining it, ie using imap_open imap_close repeated, instead of imap_open, imap_reopen repeated, imap_close. Unfortunately, the server has a limit on the number of connections per minute, so I couldn't use that method... I am implementing some conditions and exceptions, in order to avoid the segfault, and at least finish the execution of a script even if the connection is dropped. I will let everyone know if I discover the source of the issue. Nathan Nobbe wrote: On Tue, Dec 23, 2008 at 5:30 PM, Dan Osipov dosi...@phillyburbs.com wrote: Script takes about 5 minutes to run (average). On other servers I've seen it run over 2 hours without segfaults... All depends on how many messages are in the NNTP mailboxes. ok, so this is def a long running script then. After applying the mentioned patch to libc-client2002edebian the issue persisted. No change... ok, lets check that one off the list then. I'm not running xdebug. The PHP memory limit is 512 Mb and server has 16Gb of RAM, so it doesn't look like its exhausting all the memory, although one of the libraries potentially could? ok, i didnt think so, but just wanted to make sure so as not to waste time, when it could be an easy fix like that. If this helps: It looks like the script is dropping connection to the NNTP server. If it then tries to open another mailbox, it segfaults. Otherwise it continues to run successfully. hmm, well, i dont see any sort of functions in the imap api that check the integriy of the imap stream. its sounds lame, but have you considered tearing down and rebuilding the connection after a fixed number of downloads have completed. But why does it drop the connection? maybe php's client code just wasnt designed to hold imap connections open for a long periods of time. not sure though. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Segmentation fault in php5-imap
Everything matches. The only thing that's different is that the server that's having the problem has been running the script every 15 mins for the past 2 months - which leads me to believe there might be a memory leak somewhere... Although complete recompiling should reset something, right? I found this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502996 But the patch didn't work. The library is required by php5-imap (which is a standalone package). Thanks! Dan Nathan Nobbe wrote: On Tue, Dec 23, 2008 at 12:34 PM, Dan Osipov dosi...@phillyburbs.comwrote: Hello, I have a CLI PHP script I'm running on a Debian Etch server every 15 minutes, that downloads messages from NNTP server using PHP imap functions. The script is working fine on several Windows systems, and other Linux servers, but has been continuously throwing a segfault error on this particular machine. I've recompiled PHP 5.2.8 from source, upgraded all packages, recompiled libc-client2002edebian, etc. I'm at loss at what I can do to debug this issue further. Can someone recommend what I should check? have you checked the versions of the imap libraries on those systems to ensure theyre consistent across the board? not sure exactly what to look at here since i dont have a debian machine on hand but im guessing the php binary depends on some other binary being there, which there will be several versions of, surely. is there a standalone package for the imap extension in debian? also, are the other linux boxes also running debian? -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Segmentation fault in php5-imap
On Tue, Dec 23, 2008 at 1:42 PM, Dan Osipov dosi...@phillyburbs.com wrote: Everything matches. The only thing that's different is that the server that's having the problem has been running the script every 15 mins for the past 2 months - which leads me to believe there might be a memory leak somewhere... if the script isnt long running, *theorectically* speaking once php shuts down, all php allocated memory should get freed up, unless theres a bigger mem leak issue w/ php itself. Although complete recompiling should reset something, right? well if you were running an older version of php, and you upgraded to 5.2.8, then theres a chance a mem leak bug could be fixed by it. but only if they actually patched that problem. id be surprised to see a memory leak persist after a php script has run to completion. I found this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502996 But the patch didn't work. The library is required by php5-imap (which is a standalone package). hmm, so the extension wouldnt compile w/ the patch, or after building w/ the patch the problem persists? are you by chance running anything like xdebug on the server. that (and similar extensions) keep a lot of things in memory during script execution that php normally cleans up. once i had a cli script which would eat up all of the memory on the box. even unset() calls wouldnt stop the madness. then i realized i had xdebug running, disabled it, and bam, all was good again. also, do you have any idea, the duration of the script execution. -nathan
[PHP] Re: Segmentation fault in php5-imap
Script takes about 5 minutes to run (average). On other servers I've seen it run over 2 hours without segfaults... All depends on how many messages are in the NNTP mailboxes. After applying the mentioned patch to libc-client2002edebian the issue persisted. No change... I'm not running xdebug. The PHP memory limit is 512 Mb and server has 16Gb of RAM, so it doesn't look like its exhausting all the memory, although one of the libraries potentially could? If this helps: It looks like the script is dropping connection to the NNTP server. If it then tries to open another mailbox, it segfaults. Otherwise it continues to run successfully. But why does it drop the connection? Thanks a lot for your help!! Dan Nathan Nobbe wrote: On Tue, Dec 23, 2008 at 1:42 PM, Dan Osipov dosi...@phillyburbs.com wrote: Everything matches. The only thing that's different is that the server that's having the problem has been running the script every 15 mins for the past 2 months - which leads me to believe there might be a memory leak somewhere... if the script isnt long running, *theorectically* speaking once php shuts down, all php allocated memory should get freed up, unless theres a bigger mem leak issue w/ php itself. Although complete recompiling should reset something, right? well if you were running an older version of php, and you upgraded to 5.2.8, then theres a chance a mem leak bug could be fixed by it. but only if they actually patched that problem. id be surprised to see a memory leak persist after a php script has run to completion. I found this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502996 But the patch didn't work. The library is required by php5-imap (which is a standalone package). hmm, so the extension wouldnt compile w/ the patch, or after building w/ the patch the problem persists? are you by chance running anything like xdebug on the server. that (and similar extensions) keep a lot of things in memory during script execution that php normally cleans up. once i had a cli script which would eat up all of the memory on the box. even unset() calls wouldnt stop the madness. then i realized i had xdebug running, disabled it, and bam, all was good again. also, do you have any idea, the duration of the script execution. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Segmentation fault in php5-imap
On Tue, Dec 23, 2008 at 5:30 PM, Dan Osipov dosi...@phillyburbs.com wrote: Script takes about 5 minutes to run (average). On other servers I've seen it run over 2 hours without segfaults... All depends on how many messages are in the NNTP mailboxes. ok, so this is def a long running script then. After applying the mentioned patch to libc-client2002edebian the issue persisted. No change... ok, lets check that one off the list then. I'm not running xdebug. The PHP memory limit is 512 Mb and server has 16Gb of RAM, so it doesn't look like its exhausting all the memory, although one of the libraries potentially could? ok, i didnt think so, but just wanted to make sure so as not to waste time, when it could be an easy fix like that. If this helps: It looks like the script is dropping connection to the NNTP server. If it then tries to open another mailbox, it segfaults. Otherwise it continues to run successfully. hmm, well, i dont see any sort of functions in the imap api that check the integriy of the imap stream. its sounds lame, but have you considered tearing down and rebuilding the connection after a fixed number of downloads have completed. But why does it drop the connection? maybe php's client code just wasnt designed to hold imap connections open for a long periods of time. not sure though. -nathan