Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Andi Gutmans
At 05:40 PM 10/28/2002 +0200, Stanislav Malyshev wrote:

TCA>> yep - but can we simply move init_executor a bit "up"?

I fear it's as "up" as it can be - just the start of zend_activate(). The
problem, as it seems, is that some code can be called before
zend_activate() - like INI handlers.


Right and actually one shouldn't be emalloc()'ing not calling 
zval_ptr_dtor() when not in a request. Maybe the problem is the extension 
itself.

Andi


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Andi Gutmans
At 04:35 PM 10/28/2002 +0100, Thies C. Arntzen wrote:

On Mon, Oct 28, 2002 at 05:24:38PM +0200, Stanislav Malyshev wrote:
> TCA>> but zval_ptr_dtor (used in assert.c-OnChangeCallback) checks
> TCA>> against EG(uninitialized_zval_ptr) - so calling zval_ptr_dtor
> TCA>> anytime before init_executor will cause an UMR.
>
> Actually, zval_ptr_dtor calls zval_dtor, which does much more EG(...)
> games than just EG(uninitialized_zval_ptr). So I guess calling
> zval_ptr_dtor before init_executor is unwise indeed...

yep - but can we simply move init_executor a bit "up"?


It's called per-request in zend_activate. I think some of the INI stuff is 
called during module startup (when the thread is started). I'm not sure 
this can be easily fixed. We might need to initialize it in the EG ctor().

Andi


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Thies C. Arntzen
On Mon, Oct 28, 2002 at 05:49:44PM -0800, Zeev Suraski wrote:
> At 07:35 28/10/2002, Thies C. Arntzen wrote:
> >On Mon, Oct 28, 2002 at 05:24:38PM +0200, Stanislav Malyshev wrote:
> >> TCA>> but zval_ptr_dtor (used in assert.c-OnChangeCallback) checks
> >> TCA>> against EG(uninitialized_zval_ptr) - so calling zval_ptr_dtor
> >> TCA>> anytime before init_executor will cause an UMR.
> >>
> >> Actually, zval_ptr_dtor calls zval_dtor, which does much more EG(...)
> >> games than just EG(uninitialized_zval_ptr). So I guess calling
> >> zval_ptr_dtor before init_executor is unwise indeed...
> >
> >yep - but can we simply move init_executor a bit "up"?
> 
> Probably not.  Can you simply fix the OnChange callback? :)  NULL up the 
> ASSERTG(callback) on time?

it is(!) nulled in the globals_ctor. the problem is that the
OnChange gets called quite a few times (tested in cli-mode).
and the 2nd call will dtor the "empty" value set by the 1st
call.

also i don't really think that assert.c is the deal here, the
real problem is that we might use parts of the engine "too"
early in many places in the code that i haven't spotted so
far. (and it's a _very_ hard to find thing - i found it using
valgrind)

re,
tc

> 
> Zeev

-- 
Thies C. Arntzen   -   Looking for all sorts of freelance work  -   just ask..
  http://www.amazon.de/exec/obidos/wishlist/AB9DY62QWDSZ

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Zeev Suraski
At 07:35 28/10/2002, Thies C. Arntzen wrote:

On Mon, Oct 28, 2002 at 05:24:38PM +0200, Stanislav Malyshev wrote:
> TCA>> but zval_ptr_dtor (used in assert.c-OnChangeCallback) checks
> TCA>> against EG(uninitialized_zval_ptr) - so calling zval_ptr_dtor
> TCA>> anytime before init_executor will cause an UMR.
>
> Actually, zval_ptr_dtor calls zval_dtor, which does much more EG(...)
> games than just EG(uninitialized_zval_ptr). So I guess calling
> zval_ptr_dtor before init_executor is unwise indeed...

yep - but can we simply move init_executor a bit "up"?


Probably not.  Can you simply fix the OnChange callback? :)  NULL up the 
ASSERTG(callback) on time?

Zeev


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Stanislav Malyshev
TCA>> yep - but can we simply move init_executor a bit "up"?

I fear it's as "up" as it can be - just the start of zend_activate(). The 
problem, as it seems, is that some code can be called before 
zend_activate() - like INI handlers. 

-- 
Stanislav Malyshev, Zend Products Engineer   
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.109



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Thies C. Arntzen
On Mon, Oct 28, 2002 at 05:24:38PM +0200, Stanislav Malyshev wrote:
> TCA>> but zval_ptr_dtor (used in assert.c-OnChangeCallback) checks
> TCA>> against EG(uninitialized_zval_ptr) - so calling zval_ptr_dtor
> TCA>> anytime before init_executor will cause an UMR.
> 
> Actually, zval_ptr_dtor calls zval_dtor, which does much more EG(...) 
> games than just EG(uninitialized_zval_ptr). So I guess calling 
> zval_ptr_dtor before init_executor is unwise indeed... 

yep - but can we simply move init_executor a bit "up"?

re,
tc

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Stanislav Malyshev
TCA>> but zval_ptr_dtor (used in assert.c-OnChangeCallback) checks
TCA>> against EG(uninitialized_zval_ptr) - so calling zval_ptr_dtor
TCA>> anytime before init_executor will cause an UMR.

Actually, zval_ptr_dtor calls zval_dtor, which does much more EG(...) 
games than just EG(uninitialized_zval_ptr). So I guess calling 
zval_ptr_dtor before init_executor is unwise indeed... 

-- 
Stanislav Malyshev, Zend Products Engineer   
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.109




-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] problem with EG(uninitialized_zval_ptr)

2002-10-28 Thread Thies C. Arntzen

zee, andi - 

in threded mode we access (atleast)
EG(uninitialized_zval_ptr) before it's initialized ->
BadIdea(tm)

what happens is that (see assert.c as an example)
OnChangeCallback gets called by the ini-mechanism before the
executor is initialized. 

but zval_ptr_dtor (used in assert.c-OnChangeCallback) checks
against EG(uninitialized_zval_ptr) - so calling zval_ptr_dtor
anytime before init_executor will cause an UMR.

i know that the startup-order is a very delicate thing so i'd
like to check with you guys first if you have any ideas..

re,
tc


-- 
Thies C. Arntzen   -   Looking for all sorts of freelance work  -   just ask..
  http://www.amazon.de/exec/obidos/wishlist/AB9DY62QWDSZ

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php