Bug #69464 [Asn->Fbk]: Segfault in zend_hash_destroy() during shutdown

From: Date: Fri, 17 Apr 2015 15:41:27 +0000
Subject: Bug #69464 [Asn->Fbk]: Segfault in zend_hash_destroy() during shutdown
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192151@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69464&edit=1

 ID:                 69464
 Updated by:         dmitry@php.net
 Reported by:        berdir@php.net
 Summary:            Segfault in zend_hash_destroy() during shutdown
-Status:             Assigned
+Status:             Feedback
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        master-Git-2015-04-15 (Git)
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

I hope I fixed the GC problem. At least I can't reproduce it any more. Could you please retest.


Previous Comments:
------------------------------------------------------------------------
[2015-04-17 00:33:49] dmitry@php.net

I fixed two problems triggered by Drupal-8, however I see at least one unfixed GC related problem.
It may be reproduced with simple script. The problem must be visible with valgrind.

<?php
class A {
	public $a;
	public $x;
	function __destruct() {
		unset($this->x);
	}
}
$a = new A;
$a->a = $a;
$a->x = [];
$a->x[] =& $a->x;
$a->x[] = $a;
var_dump($a);
var_dump(gc_collect_cycles());
unset($a);
var_dump(gc_collect_cycles());
var_dump(gc_collect_cycles());
?>

The problem that __destructor() breaks the garbage graph, and it's destroyed only partially,
and the remaining part still keeps references to deallocated data.

------------------------------------------------------------------------
[2015-04-16 09:29:14] dmitry@php.net

this doesn't work for me. I followed your instruction + made composer update.
Anyway, I get a error (that I expect), but not any memory corruptions.

Error: Cannot use Drupal\Component\Utility\String as String because 'String' is a special
class name in ...

I probably need some branch of drupal adopted for PHP7.
Also, do you use any external extension (e.g. xdebug)?

------------------------------------------------------------------------
[2015-04-16 07:32:09] berdir@php.net

Not exactly sure what you need.

You need to get drupal and drush:

git clone http://git.drupal.org/project/drupal.git
git clone https://github.com/drush-ops/drush.git
cd drupal
gdb --args '/path/to/php7' '../drush/drush.php'
'--db-url=mysql://user:pass@localhost/db' 'si' '-y'
'standard' '-v' '-d'

Update the path to php7 and use a valid mysql username/password and that should install drupal
(which takes a while... ) and at the end, it crashes with the mentioned segfault.

------------------------------------------------------------------------
[2015-04-15 21:16:47] dmitry@php.net

I didn't get how to reproduce this.
Please provide a detailed instruction: what to download, which commands to run, etc.

------------------------------------------------------------------------
[2015-04-15 15:41:23] berdir@php.net

https://gist.github.com/Berdir/f93e56c8a2643501ce51
has a more up to date debug output now, which shows which object is causing the crash, based on
instructions from @ircmaxell

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=69464


--
Edit this bug report at https://bugs.php.net/bug.php?id=69464&edit=1


Thread (10 messages)

« previous php.bugs (#192151) next »