Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-22 Thread Arnaud Le Blanc
To: Anthony Ferrara Cc: Laruence; internals@lists.php.net Subject: Re: [PHP-DEV] Disabling the GC during shutdown However, that's not really fixing the situation either, as the zval is still getting nuked (but only partially). If there's a memory overwrite or use-after-free is going

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-22 Thread Nikita Popov
On Sat, Jun 22, 2013 at 12:06 PM, Arnaud Le Blanc arnaud...@gmail.comwrote: Hi, This bug may be related (and has a reproducing script) : https://bugs.php.net/bug.php?id=63734 ... and is private. Nikita

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-22 Thread Laruence
: Laruence; internals@lists.php.net Subject: Re: [PHP-DEV] Disabling the GC during shutdown However, that's not really fixing the situation either, as the zval is still getting nuked (but only partially). If there's a memory overwrite or use-after-free is going on, this patch

RE: [PHP-DEV] Disabling the GC during shutdown

2013-06-21 Thread Andi Gutmans
-Original Message- From: Stas Malyshev [mailto:smalys...@sugarcrm.com] Sent: Thursday, June 20, 2013 8:20 PM To: Anthony Ferrara Cc: Laruence; internals@lists.php.net Subject: Re: [PHP-DEV] Disabling the GC during shutdown However, that's not really fixing the situation either

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-20 Thread Laruence
On Thu, Jun 20, 2013 at 1:46 AM, Anthony Ferrara ircmax...@gmail.com wrote: All, We were discussing a range of bugs today with the garbage collector. For example: https://bugs.php.net/bug.php?id=64827 After quite a bit of digging, it appears what's happening is that the garbage collector is

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-20 Thread Laruence
On Thu, Jun 20, 2013 at 6:12 PM, Laruence larue...@php.net wrote: On Thu, Jun 20, 2013 at 1:46 AM, Anthony Ferrara ircmax...@gmail.com wrote: All, We were discussing a range of bugs today with the garbage collector. For example: https://bugs.php.net/bug.php?id=64827 After quite a bit of

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-20 Thread Anthony Ferrara
Laruence, Sorry, but I don't this this explain is right. if there is more than one refcount to a zval, then it should never be freed and if a zval is freed, then it must also be removed from the gc roots. The point here is that the GC is run *while* the zval is being freed.

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-20 Thread Stas Malyshev
Hi! Yes, that is what's happening here. zval_mark_grey() is trying to walk through the object's hash table, but the first bucket is already freed, so when it tries to access it bad things happen. Why is this specific to shutdown? Hashtables are freed all the time, what specific shutdown is

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-20 Thread Anthony Ferrara
Stas, Why is this specific to shutdown? Hashtables are freed all the time, what specific shutdown is doing different from all others so that this bug only happens on shutdown? Honestly, I am not sure. Every report that I've seen has it happening at shutdown. Could very well be a coincidence.

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-20 Thread Stas Malyshev
Hi! Honestly, I am not sure. Every report that I've seen has it happening at shutdown. Could very well be a coincidence. Well, if we don't know why or if it's shutdown only, disabling on shutdown wouldn't do much good. I have a patch which prevents the segfault:

[PHP-DEV] Disabling the GC during shutdown

2013-06-19 Thread Anthony Ferrara
All, We were discussing a range of bugs today with the garbage collector. For example: https://bugs.php.net/bug.php?id=64827 After quite a bit of digging, it appears what's happening is that the garbage collector is running during the shutdown of PHP. So the destructors are fired, and the

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-19 Thread Rasmus Lerdorf
On 06/19/2013 10:46 AM, Anthony Ferrara wrote: 3. Can anyone think of a reason we'd want the GC enabled during the request shutdown? I can't think of any... I don't see any reason to to GC once we start the request shutdown dance either and this is a segfault I am seeing a couple of times per

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-19 Thread Johannes Schlüter
On Jun 19, 2013, at 19:46, Anthony Ferrara ircmax...@gmail.com wrote: 1. Technically, all we need to do is force GC_G(gc_enabled) = 0 in shutdown. But we could also use zend_alter_ini_entry which has the same effect. The question comes is there any reason to go through the overhead of

Re: [PHP-DEV] Disabling the GC during shutdown

2013-06-19 Thread Anthony Ferrara
Johannes, On Wed, Jun 19, 2013 at 2:43 PM, Johannes Schlüter johan...@schlueters.dewrote: On Jun 19, 2013, at 19:46, Anthony Ferrara ircmax...@gmail.com wrote: 1. Technically, all we need to do is force GC_G(gc_enabled) = 0 in shutdown. But we could also use zend_alter_ini_entry which