Bug #61415 [Opn]: zend_alter_ini_entry failuers

2012-03-19 Thread info at simonecaruso dot com
Edit report at https://bugs.php.net/bug.php?id=61415&edit=1

 ID: 61415
 User updated by:info at simonecaruso dot com
 Reported by:info at simonecaruso dot com
 Summary:zend_alter_ini_entry failuers
 Status: Open
 Type:   Bug
 Package:Safe Mode/open_basedir
 Operating System:   Linux
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

I really would like debug php and find what's wrong.

For now i moved from PHP_INI_STAGE_RUNTIME to PHP_INI_STAGE_ACTIVATE and the 
problem disappeared.

But now i get this in logs when apache stops:
[]/Zend/zend_ini.c(278) :  Freeing 0x7F63E5BB4908 (72 bytes), script=/home/www-
data/mesogeamag.it/html/index.php
[]/Zend/zend_ini.c(279) :  Freeing 0x7F63E5BB49A8 (64 bytes), script=/home/www-
data/mesogeamag.it/html/index.php
[]/Zend/zend_alloc.c(2454) : Actual location (location was relayed)
[]/Zend/zend_hash.c(250) :  Freeing 0x7F63E5BB4A40 (84 bytes), script=/home/www-
data/mesogeamag.it/html/index.php
[]/Zend/zend_ini.c(289) :  Freeing 0x7F63E5BB4AE8 (64 bytes), script=/home/www-
data/mesogeamag.it/html/index.php


Thank you for help


Previous Comments:

[2012-03-17 18:43:13] cataphr...@php.net

The fact it worked in 5.2 doesn't imply your code had no bug. It may mean that 
a bug has always existed, but by luck it wasn't triggered by 5.2. Of course, if 
you could identify the specific commit that triggers the problem, it could shed 
light on this problem. If you can automate the tests, you can easily run 
something a bisection procedure to find such commit.


[2012-03-16 23:27:31] info at simonecaruso dot com

I don't think it's a my  module problem because with 5.2 i dont have this 
problem 
(i did the sames tests for 5.3, same apache, same config), i moved to 5.3 from 
less 
than one month. I don't think it's a concurrency related issue too, the failure 
are 
too much rare i think.

I did a diff between 5.2 and 5.3 and saw there are major changes to 
fopen_wrapper.c, and i have this problem only for open_basedir, that's why i 
opened 
the bug.

I'll try with other stages in the hope this can help.


[2012-03-16 21:41:22] cataphr...@php.net

I assume you're using the prefork SAPI, as the stack trace shows you're not 
using ZTS. In that case, I find strange your claim this is a concurrency issue. 
More likely, the problem would be in your module and I don't know anything 
about Apache modules lifecycle to even guess where the problem could be.

You could try passing another value for stage as the ini update handler for 
open_basedir can never fail for stages PHP_INI_STAGE_STARTUP, 
PHP_INI_STAGE_SHUTDOWN, PHP_INI_STAGE_ACTIVATE,PHP_INI_STAGE_DEACTIVATE, but 
this would most likely just mask the underlying problem. You can also try 
running Apache under valgrind with --trace-children and see if you get 
something.


[2012-03-16 18:07:23] info at simonecaruso dot com

It breaks always at zend_ini.c:300

The data i pass is always correct, but sometimes i get a FAILURE.

Breakpoint 3, zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", 
name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
300 return FAILURE;
(gdb) bt full
#0  zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
ini_entry = 0x7f2debb35d30
duplicate = 0x7f2debaf3140 'Z' , "N\230D\300ZQ\twe-
\177"
modifiable = 7 '\a'
modified = 1 '\001'
#1  0x7f2de77f00d0 in zend_alter_ini_entry (name=0x7f2de6128199 
"open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16)
at /root/php-5.3.10/Zend/zend_ini.c:249
No locals.
#2  0x7f2de6126c1d in mod_vhost_ldap_translate_name (r=0x7f2debd01570) at 
mod_vhost_ldap_ng.c:862
reqc = 0x7f2deb4b0510
conf = 0x7f2deba31038
core = 0x7f2deb9695e8
ld = 0x0
realfile = 0x0
alias = 0x0
i = 0
ret = 0
str = {0x0, 0x0, 0x0}
ldapmsg = 0x0
vhostentry = 0x0
openbasedir = 0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"
include = 0x7f2debd02e08 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"

-

Bug #61415 [Opn]: zend_alter_ini_entry failuers

2012-03-17 Thread cataphract
Edit report at https://bugs.php.net/bug.php?id=61415&edit=1

 ID: 61415
 Updated by: cataphr...@php.net
 Reported by:info at simonecaruso dot com
 Summary:zend_alter_ini_entry failuers
 Status: Open
 Type:   Bug
 Package:Safe Mode/open_basedir
 Operating System:   Linux
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

The fact it worked in 5.2 doesn't imply your code had no bug. It may mean that 
a bug has always existed, but by luck it wasn't triggered by 5.2. Of course, if 
you could identify the specific commit that triggers the problem, it could shed 
light on this problem. If you can automate the tests, you can easily run 
something a bisection procedure to find such commit.


Previous Comments:

[2012-03-16 23:27:31] info at simonecaruso dot com

I don't think it's a my  module problem because with 5.2 i dont have this 
problem 
(i did the sames tests for 5.3, same apache, same config), i moved to 5.3 from 
less 
than one month. I don't think it's a concurrency related issue too, the failure 
are 
too much rare i think.

I did a diff between 5.2 and 5.3 and saw there are major changes to 
fopen_wrapper.c, and i have this problem only for open_basedir, that's why i 
opened 
the bug.

I'll try with other stages in the hope this can help.


[2012-03-16 21:41:22] cataphr...@php.net

I assume you're using the prefork SAPI, as the stack trace shows you're not 
using ZTS. In that case, I find strange your claim this is a concurrency issue. 
More likely, the problem would be in your module and I don't know anything 
about Apache modules lifecycle to even guess where the problem could be.

You could try passing another value for stage as the ini update handler for 
open_basedir can never fail for stages PHP_INI_STAGE_STARTUP, 
PHP_INI_STAGE_SHUTDOWN, PHP_INI_STAGE_ACTIVATE,PHP_INI_STAGE_DEACTIVATE, but 
this would most likely just mask the underlying problem. You can also try 
running Apache under valgrind with --trace-children and see if you get 
something.


[2012-03-16 18:07:23] info at simonecaruso dot com

It breaks always at zend_ini.c:300

The data i pass is always correct, but sometimes i get a FAILURE.

Breakpoint 3, zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", 
name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
300 return FAILURE;
(gdb) bt full
#0  zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
ini_entry = 0x7f2debb35d30
duplicate = 0x7f2debaf3140 'Z' , "N\230D\300ZQ\twe-
\177"
modifiable = 7 '\a'
modified = 1 '\001'
#1  0x7f2de77f00d0 in zend_alter_ini_entry (name=0x7f2de6128199 
"open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16)
at /root/php-5.3.10/Zend/zend_ini.c:249
No locals.
#2  0x7f2de6126c1d in mod_vhost_ldap_translate_name (r=0x7f2debd01570) at 
mod_vhost_ldap_ng.c:862
reqc = 0x7f2deb4b0510
conf = 0x7f2deba31038
core = 0x7f2deb9695e8
ld = 0x0
realfile = 0x0
alias = 0x0
i = 0
ret = 0
str = {0x0, 0x0, 0x0}
ldapmsg = 0x0
vhostentry = 0x0
openbasedir = 0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"
include = 0x7f2debd02e08 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"


[2012-03-16 15:59:22] info at simonecaruso dot com

It will take some time for me to debug into php code, even because the problem 
happen only on the ~5% of requests, my users notice the problem only with my 
server are under load.

For now, I can add this: we have this problem since migrated from 5.2.6 to 
5.3.10.


[2012-03-16 14:25:35] cataphr...@php.net

zend_alter_ini_entry_ex has several failure paths. It would be helpful to know 
which one is being triggered. Can you investigate this? You can try first by 
starting apache under gdb with the -X option.




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

Bug #61415 [Opn]: zend_alter_ini_entry failuers

2012-03-16 Thread info at simonecaruso dot com
Edit report at https://bugs.php.net/bug.php?id=61415&edit=1

 ID: 61415
 User updated by:info at simonecaruso dot com
 Reported by:info at simonecaruso dot com
 Summary:zend_alter_ini_entry failuers
 Status: Open
 Type:   Bug
 Package:Safe Mode/open_basedir
 Operating System:   Linux
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

I don't think it's a my  module problem because with 5.2 i dont have this 
problem 
(i did the sames tests for 5.3, same apache, same config), i moved to 5.3 from 
less 
than one month. I don't think it's a concurrency related issue too, the failure 
are 
too much rare i think.

I did a diff between 5.2 and 5.3 and saw there are major changes to 
fopen_wrapper.c, and i have this problem only for open_basedir, that's why i 
opened 
the bug.

I'll try with other stages in the hope this can help.


Previous Comments:

[2012-03-16 21:41:22] cataphr...@php.net

I assume you're using the prefork SAPI, as the stack trace shows you're not 
using ZTS. In that case, I find strange your claim this is a concurrency issue. 
More likely, the problem would be in your module and I don't know anything 
about Apache modules lifecycle to even guess where the problem could be.

You could try passing another value for stage as the ini update handler for 
open_basedir can never fail for stages PHP_INI_STAGE_STARTUP, 
PHP_INI_STAGE_SHUTDOWN, PHP_INI_STAGE_ACTIVATE,PHP_INI_STAGE_DEACTIVATE, but 
this would most likely just mask the underlying problem. You can also try 
running Apache under valgrind with --trace-children and see if you get 
something.


[2012-03-16 18:07:23] info at simonecaruso dot com

It breaks always at zend_ini.c:300

The data i pass is always correct, but sometimes i get a FAILURE.

Breakpoint 3, zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", 
name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
300 return FAILURE;
(gdb) bt full
#0  zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
ini_entry = 0x7f2debb35d30
duplicate = 0x7f2debaf3140 'Z' , "N\230D\300ZQ\twe-
\177"
modifiable = 7 '\a'
modified = 1 '\001'
#1  0x7f2de77f00d0 in zend_alter_ini_entry (name=0x7f2de6128199 
"open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16)
at /root/php-5.3.10/Zend/zend_ini.c:249
No locals.
#2  0x7f2de6126c1d in mod_vhost_ldap_translate_name (r=0x7f2debd01570) at 
mod_vhost_ldap_ng.c:862
reqc = 0x7f2deb4b0510
conf = 0x7f2deba31038
core = 0x7f2deb9695e8
ld = 0x0
realfile = 0x0
alias = 0x0
i = 0
ret = 0
str = {0x0, 0x0, 0x0}
ldapmsg = 0x0
vhostentry = 0x0
openbasedir = 0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"
include = 0x7f2debd02e08 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"


[2012-03-16 15:59:22] info at simonecaruso dot com

It will take some time for me to debug into php code, even because the problem 
happen only on the ~5% of requests, my users notice the problem only with my 
server are under load.

For now, I can add this: we have this problem since migrated from 5.2.6 to 
5.3.10.


[2012-03-16 14:25:35] cataphr...@php.net

zend_alter_ini_entry_ex has several failure paths. It would be helpful to know 
which one is being triggered. Can you investigate this? You can try first by 
starting apache under gdb with the -X option.


[2012-03-16 11:38:37] info at simonecaruso dot com

Description:

I wrote an apache2.2 module that changs open_basedir and php_includepath 
dynamically into translatename hook with zend_alter_ini_entry.

This works perfectly but for about 5% of requests i get a PHP Warning with a 
wrong open_basedir.

>From my debug logs i get a FAILURE on zend_alter_ini_entry("open_basedir",...)
with the rate of about 5 requests over 100; this never happen for 'includepath' 
ini entry. For any call to zend_alter_ini_entry i submit always the same string 
for each virtualhost, i 

Bug #61415 [Opn]: zend_alter_ini_entry failuers

2012-03-16 Thread cataphract
Edit report at https://bugs.php.net/bug.php?id=61415&edit=1

 ID: 61415
 Updated by: cataphr...@php.net
 Reported by:info at simonecaruso dot com
 Summary:zend_alter_ini_entry failuers
 Status: Open
 Type:   Bug
 Package:Safe Mode/open_basedir
 Operating System:   Linux
 PHP Version:5.3.10
 Block user comment: N
 Private report: N

 New Comment:

I assume you're using the prefork SAPI, as the stack trace shows you're not 
using ZTS. In that case, I find strange your claim this is a concurrency issue. 
More likely, the problem would be in your module and I don't know anything 
about Apache modules lifecycle to even guess where the problem could be.

You could try passing another value for stage as the ini update handler for 
open_basedir can never fail for stages PHP_INI_STAGE_STARTUP, 
PHP_INI_STAGE_SHUTDOWN, PHP_INI_STAGE_ACTIVATE,PHP_INI_STAGE_DEACTIVATE, but 
this would most likely just mask the underlying problem. You can also try 
running Apache under valgrind with --trace-children and see if you get 
something.


Previous Comments:

[2012-03-16 18:07:23] info at simonecaruso dot com

It breaks always at zend_ini.c:300

The data i pass is always correct, but sometimes i get a FAILURE.

Breakpoint 3, zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", 
name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
300 return FAILURE;
(gdb) bt full
#0  zend_alter_ini_entry_ex (name=0x7f2de6128199 "open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16, 
force_change=0)
at /root/php-5.3.10/Zend/zend_ini.c:300
ini_entry = 0x7f2debb35d30
duplicate = 0x7f2debaf3140 'Z' , "N\230D\300ZQ\twe-
\177"
modifiable = 7 '\a'
modified = 1 '\001'
#1  0x7f2de77f00d0 in zend_alter_ini_entry (name=0x7f2de6128199 
"open_basedir", name_length=13,
new_value=0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/", new_value_length=58, modify_type=4, 
stage=16)
at /root/php-5.3.10/Zend/zend_ini.c:249
No locals.
#2  0x7f2de6126c1d in mod_vhost_ldap_translate_name (r=0x7f2debd01570) at 
mod_vhost_ldap_ng.c:862
reqc = 0x7f2deb4b0510
conf = 0x7f2deba31038
core = 0x7f2deb9695e8
ld = 0x0
realfile = 0x0
alias = 0x0
i = 0
ret = 0
str = {0x0, 0x0, 0x0}
ldapmsg = 0x0
vhostentry = 0x0
openbasedir = 0x7f2debd02e48 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"
include = 0x7f2debd02e08 "/tmp/:/usr/share/php/:.:/home/www-
data/musitalia.com/html/"


[2012-03-16 15:59:22] info at simonecaruso dot com

It will take some time for me to debug into php code, even because the problem 
happen only on the ~5% of requests, my users notice the problem only with my 
server are under load.

For now, I can add this: we have this problem since migrated from 5.2.6 to 
5.3.10.


[2012-03-16 14:25:35] cataphr...@php.net

zend_alter_ini_entry_ex has several failure paths. It would be helpful to know 
which one is being triggered. Can you investigate this? You can try first by 
starting apache under gdb with the -X option.


[2012-03-16 11:38:37] info at simonecaruso dot com

Description:

I wrote an apache2.2 module that changs open_basedir and php_includepath 
dynamically into translatename hook with zend_alter_ini_entry.

This works perfectly but for about 5% of requests i get a PHP Warning with a 
wrong open_basedir.

>From my debug logs i get a FAILURE on zend_alter_ini_entry("open_basedir",...)
with the rate of about 5 requests over 100; this never happen for 'includepath' 
ini entry. For any call to zend_alter_ini_entry i submit always the same string 
for each virtualhost, i can't understand why the function output change without 
a input values change.

(gdb) bt full
#0  zend_alter_ini_entry_ex (name=0x7fff3913b4b0 "ø>\026\002", name_length=1, 
new_value=0x7fea30fa4250 "/home/www-data/gamerinside.it/html/",
new_value_length=957592432, modify_type=31715296, stage=32746, 
force_change=0) at /root/php53/php-5.3.3/Zend/zend_ini.c:254
ini_entry = (zend_ini_entry *) 0x7fea30fa40e8
modified = 224 'à'
#1  0x7fea2a670530 in zend_alter_ini_entry (name=0x7fea290e3f39 
"open_basedir", name_length=13,
new_value=0x23e89e8 "/tmp/:/usr/share/php/:.:/home/www-
data/gamerinsi