Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! I thought Yoram sent some very simple test case yesterday. Yes, as Gwynne commented, this test case doesn't do what PHP does, since it compiles .so into the binary, and mod_php is not compiled into Apache's binary, and this changes the way it works. -- Stanislav Malyshev, Software Arch

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Dmitry Stogov
I thought Yoram sent some very simple test case yesterday. Thanks. Dmitry. On 02/13/2012 10:23 PM, Stas Malyshev wrote: Hi! Indeed, when using dlsym the value is recreated. now the question is what happens at apache restart (on mac) that causes incorrect behavior. a-priory to that question, s

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! Indeed, when using dlsym the value is recreated. now the question is what happens at apache restart (on mac) that causes incorrect behavior. a-priory to that question, static initializers can not be trusted on some situations. I think we need to figure out why. This is standard behavior fo

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Indeed, when using dlsym the value is recreated. now the question is what happens at apache restart (on mac) that causes incorrect behavior. a-priory to that question, static initializers can not be trusted on some situations. On Monday, February 13, 2012 11:44:15 AM Gwynne Raskind wrote: > On M

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Gwynne Raskind
On Mon, Feb 13, 2012 at 04:38, yoram bar haim wrote: > Here is a simple test program that reproduce the issue on mac: [snip] > shell> gcc -o lib.so -shared lib.c > shell> gcc -o main main.c lib.so > shell> ./main This example is flawed. The manpage for dlclose(3) on Darwin explicitly states that

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
The last reproduction was executed on darwin 10.8 with gcc 4.2.1 On Monday, February 13, 2012 11:16:41 AM Stas Malyshev wrote: > Hi! > > > I'm not familiar with Mac, but I saw such behavior on Linux very long > > time ago, when on PHP restart static variables were still keep values > > from old p

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Here is a simple test program that reproduce the issue on mac: lib.h: #include "lib.h" void set_index(

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Hi Stas reproduction is indeed easy - just change a static variable (e.q. call zend_set_user_opcode_handler()), then send SIGHUP to apache parent process and check the value in zend_user_opcode_handlers or zend_user_opcodes. it is possible that this problem is related to specific gcc versions bu

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! I'm not familiar with Mac, but I saw such behavior on Linux very long time ago, when on PHP restart static variables were still keep values from old process. That might happen if the shared library was not unloaded (dlopen will not re-load library that is already loaded) however I don't u

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Dmitry Stogov
I'm not familiar with Mac, but I saw such behavior on Linux very long time ago, when on PHP restart static variables were still keep values from old process. Thanks. Dmitry. On 02/13/2012 01:02 PM, Stas Malyshev wrote: Hi! Hi Dmitry. the patch does work, in sense of actually restoring the h

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! Hi Dmitry. the patch does work, in sense of actually restoring the handlers state when you call zend_set_user_opcode_handler() with original handler. the patch does not solve the basic problem of no re-initialization of static arrayes on mac. Could you please describe in more details what'