RE: [PHP-DEV] FW: [PHP] PHP 5.2.3 segfault with syslog standard extension
| From: | Nir) | Date: | Tue, 04 Dec 2007 14:07:00 +0000 |
| Subject: | RE: [PHP-DEV] FW: [PHP] PHP 5.2.3 segfault with syslog standard extension | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33638@lists.php.net to get a copy of this message | ||
Hi,
Are there any tools you can recommend me for debugging my error?
Standard gdb debugging doesn't seem to help, and using valgrind in a
real-time webserver environment simply doesn't work on my device (or on
anyone's device I guess.. :) ).
Thanks, Nir.
-----Original Message-----
From: Antony Dovgal [mailto:tony@daylessday.org]
Sent: Monday, December 03, 2007 5:41 PM
To: Rachmel, Nir (Nir)
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] FW: [PHP] PHP 5.2.3 segfault with syslog standard
extension
On 03.12.2007 18:19, Rachmel, Nir (Nir) wrote:
> Hi,
>
> I have been doing some code-reading. Why is the RSHUTDOWN function for
> syslog ext called only when run under win32?
> Shouldn't the cleanup happen on linux as well?
man closelog says it's not required.
DESCRIPTION
closelog() closes the descriptor being used to write to the
system logger. The use of closelog() is optional.
> Another question is for the use of zend_strndup instead of one of the
> non-persistent memory allocation functions (i.e. estrndup() ) ?
> There is no use for this variable after the request dies (as far as I
> understand).
Right, if you use estrndup(), the memory is freed at the end of request,
while zend_strndup() bypasses Zend memory manager using malloc()
directly.
> However, so far, I can't seem to understand who/what corrupts my
memory.
Me neither :/
> What do you think about extending the RINIT function instead of:
> PHP_RINIT_FUNCTION(syslog)
> {
> if (INI_INT("define_syslog_variables")) {
> start_syslog(TSRMLS_C);
> } else {
> BG(syslog_started)=0;
> BG(syslog_device)=NULL; /* This is the addition */
I think this would just create a memleak.
BG(syslog_device) is checked for NULL and freed in openlog() and
MSHUTDOWN.
--
Wbr,
Antony Dovgal