#17591 [Opn->Fbk]: segfault when trying to access a global variable

From: Date: Mon, 09 Sep 2002 16:21:25 +0000
Subject: #17591 [Opn->Fbk]: segfault when trying to access a global variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18822@lists.php.net to get a copy of this message
ID: 17591 Updated by: stas@php.net Reported By: dschmidt@informationsgesellschaft.com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: Linux (Suse 7.3) PHP Version: 4.2.1 New Comment: Circular refernces _are_ supported (meaning, they will work, etc.) but indeed cause 'memory leak' messages. This is not real leaks, because they are cleaned at the end of the request. As for the crash - please try to produce some short code that reproduces the problem, or at least refine the circumstances when it happens. Also, you may want to try latest version (4.2.3) or latest CVS snapshot (snaps.php.net). Previous Comments: ------------------------------------------------------------------------ [2002-06-05 11:15:11] dschmidt@informationsgesellschaft.com Shouldn't that restriction be documented somewhere? Can these circular references cause any other problems or errors than in the garbage collection? Would it be a solution to cut off these references in a destructor method before the script ends? Does the garbage collector call a destructor method for objects? ------------------------------------------------------------------------ [2002-06-04 08:57:16] mfischer@php.net The zend engine doesn't support circular refereing and never will (hence the memory leaks you see with the debug build). This won't get fixed. Seems that accessing the global var in your example as you described it is a very negative side effect. I guess unless you can post a reproduceable example there's nothing we can do about it. ------------------------------------------------------------------------ [2002-06-04 07:22:48] dschmidt@informationsgesellschaft.com yes, we use both. We have objects with attributes pointing to other objects. These other objects may have an attribute pointing back to the first object. ------------------------------------------------------------------------ [2002-06-04 06:30:41] mfischer@php.net Are you using objects and circular references? ------------------------------------------------------------------------ [2002-06-04 06:12:58] dschmidt@informationsgesellschaft.com After the Upgrade from php 4.0.6 to php 4.2.1 our Application crashes (httpd segmentation fault) We used the dgb Debugger (dd.cron.ru) to figure out where it happens: Inside a function when trying to make a global variable available with the global statement (global $xyz;). We were not able to reproduce that error inside a short script. It only occurs in our (complex) Application (with a lot of classes) and only under certain circumstances. after that, we tried to get a backtrace (we followed the guide in http://bugs.php.net/bugs-generating-backtrace.php). After compiling php with --enable-debug we were not able to reproduce the error. Instead we got a lot of messages in the httpd-error_log: ------------------------- zend_language_scanner.c(4363) : Freeing 0x0825CDC4 (1 bytes), script=/usr/local/httpd/htdocs/AdditorDev/Website/page.php Last leak repeated 1 time ./zend_execute.c(1999) : Freeing 0x081EF674 (12 bytes), script=/usr/local/httpd/htdocs/AdditorDev/Website/page.php Last leak repeated 3 times ./zend_execute.c(2002) : Freeing 0x081EF454 (25 bytes), script=/usr/local/httpd/htdocs/AdditorDev/Website/page.php zend_variables.c(106) : Actual location (location was relayed) Last leak repeated 1 time zend_hash.c(260) : Freeing 0x08493A7C (48 bytes), script=/usr/local/httpd/htdocs/AdditorDev/Website/Additor/XmlConnect.php Last leak repeated 597 times -------------------------- I don't know what this means. Our configure-line: ./configure --enable-sockets --enable-memory-limit --with-mysql --with-apxs --with-xslt-sablot --with-sablot=/usr/local/lib --with-expat=/usr/local/lib --with-ldap --with-debugger --with-ftp --with-config-file-path=/etc/ --enable-trans-sid --enable-track-vars --enable-trans-sid --with-zlib-dir=/usr/lib --with-ming --with-oci8=/opt/oracle/OraHome1 --enable-xslt -enable-debug thanx Dirk Schmidt ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17591&edit=1

« previous php.bugs (#18822) next »