Hi Pierre,

The following test may crash on the second request with opcode cache.

<?php

trait THello {

  public function hello() { echo 'Hello'; }
}

class TraitsTest { use THello; }

$test = new TraitsTest();
$test->hello();

?>

Valgrind shows the problem even if PHP doesn't crash.

==2623== Invalid free() / delete / delete[] / realloc()
==2623== at 0x4007F0F: free (vg_replace_malloc.c:446)
==2623== by 0x837CC7C: zend_clear_trait_method_name (zend_opcode.c:273)
==2623== by 0x8393B1B: zend_hash_apply (zend_hash.c:716)
==2623== by 0x837D4C7: destroy_zend_class (zend_opcode.c:312)
==2623== by 0x8392464: zend_hash_apply_deleter (zend_hash.c:650)
==2623== by 0x8393D38: zend_hash_reverse_apply (zend_hash.c:804)
==2623== by 0x8378C3B: shutdown_executor (zend_execute_API.c:305)
==2623== by 0x8386C09: zend_deactivate (zend.c:938)
==2623== by 0x8329815: php_request_shutdown (main.c:1790)
With opcode cache op_code->function_name is actually allocated in shared
memory .

Thanks. Dmitry.

On Thu, Dec 20, 2012 at 12:07 PM, Pierre Joye <pierre....@gmail.com> wrote:

> btw, same to test your changes/branch, as we have seen some crashes
> happening more easily on windows (same bug(s) on linux but with harder
> to get them crash).
>
> On Thu, Dec 20, 2012 at 9:02 AM, Pierre Joye <pierre....@gmail.com> wrote:
> > hi Dmitry!
> >
> > On Thu, Dec 20, 2012 at 7:54 AM, Dmitry Stogov <dmi...@zend.com> wrote:
> >
> > Thanks a lot to work on that :)
> >
> >> I'm not sure about APC, I saw the problem in ZendOptimizerPlus with
> >> php-5.4.10.
> >> O+ crashes (or corrupts memory and crashes on following requests) on
> each
> >> trait usage.
> >> The problem that PHP tries to deallocate names of methods defined in
> >> traits, but O+ keeps them in SHM.
> >> I believe APC must have the same problem.
> >
> > Do you have some phpt to share? I can run them in our tests labs and
> > report issues to the bugs tracker, and see if Anatolyi can help to fix
> > them as well.
> >
> >
> > Cheers,
> > --
> > Pierre
> >
> > @pierrejoye
>
>
>
> --
> Pierre
>
> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org
>

Reply via email to