[PHP-DEV] PHP_5_3 GC segfaults

2009-12-05 Thread Rasmus Lerdorf
I'm seeing some GC-related segfaults in current PHP_5_3.  I haven't had
time to dive into it very far.  All I have is a couple of bts and the
request that triggers it, but it is a gallery2 request and there is a
lot of code there.  I'll see if I can get it down to something
manageable.  The first bt is:

Program received signal SIGSEGV, Segmentation fault.
0x7f4d6b3df8f1 in gc_zval_possible_root (zv=0x232e098) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:143
143 GC_ZOBJ_CHECK_POSSIBLE_ROOT(zv);
(gdb) bt
#0  0x7f4d6b3df8f1 in gc_zval_possible_root (zv=0x232e098) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:143
#1  0x7f4d6b3ce11b in zend_hash_destroy (ht=0x2323e78) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_hash.c:526
#2  0x7f4d6b3c14ff in _zval_dtor_func (zvalue=0x232df78) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_variables.c:43
#3  0x7f4d6b3b5ccd in _zval_dtor (zval_ptr=0x232df58) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_variables.h:35
#4  _zval_ptr_dtor (zval_ptr=0x232df58) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c:435
#5  0x7f4d6b3ce11b in zend_hash_destroy (ht=0x2323f88) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_hash.c:526
#6  0x7f4d6b3c14ff in _zval_dtor_func (zvalue=0x232df28) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_variables.c:43
#7  0x7f4d6b3b5ccd in _zval_dtor (zval_ptr=0x23561e8) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_variables.h:35
#8  _zval_ptr_dtor (zval_ptr=0x23561e8) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c:435
#9  0x7f4d6b3ce11b in zend_hash_destroy (ht=0x2323ce0) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_hash.c:526
#10 0x7f4d6b3e0e69 in zend_object_std_dtor (object=0x2355790) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects.c:45
#11 0x7f4d6b3e0e89 in zend_objects_free_object_storage
(object=0x232e098) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects.c:114
#12 0x7f4d6b3e47c9 in zend_objects_store_del_ref_by_handle_ex
(handle=9, handlers=)
at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects_API.c:220
#13 0x7f4d6b3e47e3 in zend_objects_store_del_ref (zobject=0x2342c00)
at /home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects_API.c:172
#14 0x7f4d6b3b5ccd in _zval_dtor (zval_ptr=0x22fe8b8) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_variables.h:35
#15 _zval_ptr_dtor (zval_ptr=0x22fe8b8) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c:435
#16 0x7f4d6b3ce11b in zend_hash_destroy (ht=0x2323bb0) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_hash.c:526
#17 0x7f4d6b3e0e69 in zend_object_std_dtor (object=0x22fe990) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects.c:45
#18 0x7f4d6b3e0e89 in zend_objects_free_object_storage
(object=0x232e098) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects.c:114
#19 0x7f4d6b3e42fc in zend_objects_store_free_object_storage
(objects=0x7f4d6bb79f58) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_objects_API.c:92
#20 0x7f4d6b3b82e5 in shutdown_executor () at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c:298
#21 0x7f4d6b3c21d2 in zend_deactivate () at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend.c:890
#22 0x7f4d6b36e182 in php_request_shutdown (dummy=) at /home/rasmus/src/php/php-src/branches/PHP_5_3/main/main.c:1606

And another:

Program received signal SIGSEGV, Segmentation fault.
zval_mark_grey (pz=0x114f458) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:356
356 p = Z_ARRVAL_P(pz)->pListHead;
(gdb) bt
#0  zval_mark_grey (pz=0x114f458) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:356
#1  0x7f7ef6d57e39 in zval_mark_grey (pz=0x114f458) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:367
#2  0x7f7ef6d5846d in gc_mark_roots () at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:417
#3  gc_collect_cycles () at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend_gc.c:628
#4  0x7f7ef6d3b2a5 in zend_deactivate () at
/home/rasmus/src/php/php-src/branches/PHP_5_3/Zend/zend.c:900
#5  0x7f7ef6ce7182 in php_request_shutdown (dummy=) at /home/rasmus/src/php/php-src/branches/PHP_5_3/main/main.c:1606
#6  0x7f7ef6dc4f83 in php_apache_request_dtor (r=0xee3148) at
/home/rasmus/src/php/php-src/branches/PHP_5_3/sapi/apache2handler/sapi_apache2.c:493
(gdb) p pz
$1 = (zval *) 0x114f458
(gdb) p *pz
$2 = {value = {lval = 0, dval = 0, str = {val = 0x0, len = 17070608}, ht
= 0x0, obj = {handle = 0, handlers = 0x1047a10}}, refcount__gc =
4294967295, type = 4 '\004',
  is_ref__gc = 0 '\000'

garbage zval there with a null value.ht, so that Z_ARRVAL_P isn't 

[PHP-DEV] Persistent cURL handles.

2009-12-05 Thread Joseph Marrero
Hi everyone.

I have some changes for persistent curl handles. I think this should
improve performance. If you agree, please review the code for
correctness and perhaps consider adding it to the cURL extension.

Some changes are obviously needed. The references to "fap" and/or "FAP"
refer to our company's modifications and should probably be removed or
changed.

Happy hacking!


Get it here:
http://www.manvscode.com/download/curl_fap.tar.gz



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



Re: [PHP-DEV] Stream: Cast and Seek

2009-12-05 Thread Arnaud Le Blanc
Le samedi 05 décembre 2009 à 18:00 +0100, Samuel ROZE a écrit :
> Thanks for you reply ! :-)
> I think that my cast isn't very good because I've:
> 
> Warning: stream_select(): You MUST recompile PHP with a larger value of 
> FD_SETSIZE.
> It is set to 1024, but you have descriptors numbered at least as high as 
> 1728763902.
>  --enable-fd-setsize=1728763904 is recommended, but you may want to set it
> to equal the maximum number of open files supported by your system,
> in order to avoid seeing this error again at a later date. in ...

Check if stream->abstract is a php_ssh2_session_data (looks like it may
be a _channel_data instead).

> 
> That my cast code (patch on PHP 5.3 branche):
> http://www.d-sites.com/wp-content/uploads/2009/12/cast_ssh2_stream.patch
> 
> Is there something wrong ?
> 
> Regards,
> Samuel.
> 
> Le samedi 05 décembre 2009 à 13:40 +0100, Arnaud Le Blanc a écrit :
> > Hi,
> > 
> > Le samedi 05 décembre 2009 à 00:01 +0100, Samuel ROZE a écrit :
> > > Hello,
> > > 
> > > I'm working on the use of a PHP SSH2 Stream returned by ssh2_shell
> > > function with stream_select() function. Within the PHP code, before
> > > being used into the select() C function, a stream have to be "casted"...
> > > The problem is that I don't really know what is it and how it generally
> > > works.
> > > 
> > > So, can someone explain to me what means "cast" and "seek" streams ?
> > > 
> > > (In fact, I have to cast a php_ssh2_channel_stream)
> > 
> > Here you need to return the underlaying socket on which the ssh session
> > is established, so that the OS's select() can work on it. Look at
> > php_openssl_sockop_cast for an example.
> > 
> > Regards,
> > 
> > Arnaud
> > 
> > > 
> > > Thanks a lot.
> > > Regards,
> > > Samuel ROZE.
> > > 
> > > 
> > > 
> > 
> 
> 


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



Re: [PHP-DEV] Stream: Cast and Seek

2009-12-05 Thread Samuel ROZE
Thanks for you reply ! :-)
I think that my cast isn't very good because I've:

Warning: stream_select(): You MUST recompile PHP with a larger value of 
FD_SETSIZE.
It is set to 1024, but you have descriptors numbered at least as high as 
1728763902.
 --enable-fd-setsize=1728763904 is recommended, but you may want to set it
to equal the maximum number of open files supported by your system,
in order to avoid seeing this error again at a later date. in ...

That my cast code (patch on PHP 5.3 branche):
http://www.d-sites.com/wp-content/uploads/2009/12/cast_ssh2_stream.patch

Is there something wrong ?

Regards,
Samuel.

Le samedi 05 décembre 2009 à 13:40 +0100, Arnaud Le Blanc a écrit :
> Hi,
> 
> Le samedi 05 décembre 2009 à 00:01 +0100, Samuel ROZE a écrit :
> > Hello,
> > 
> > I'm working on the use of a PHP SSH2 Stream returned by ssh2_shell
> > function with stream_select() function. Within the PHP code, before
> > being used into the select() C function, a stream have to be "casted"...
> > The problem is that I don't really know what is it and how it generally
> > works.
> > 
> > So, can someone explain to me what means "cast" and "seek" streams ?
> > 
> > (In fact, I have to cast a php_ssh2_channel_stream)
> 
> Here you need to return the underlaying socket on which the ssh session
> is established, so that the OS's select() can work on it. Look at
> php_openssl_sockop_cast for an example.
> 
> Regards,
> 
> Arnaud
> 
> > 
> > Thanks a lot.
> > Regards,
> > Samuel ROZE.
> > 
> > 
> > 
> 



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



Re: [PHP-DEV] Stream: Cast and Seek

2009-12-05 Thread Arnaud Le Blanc
Hi,

Le samedi 05 décembre 2009 à 00:01 +0100, Samuel ROZE a écrit :
> Hello,
> 
> I'm working on the use of a PHP SSH2 Stream returned by ssh2_shell
> function with stream_select() function. Within the PHP code, before
> being used into the select() C function, a stream have to be "casted"...
> The problem is that I don't really know what is it and how it generally
> works.
> 
> So, can someone explain to me what means "cast" and "seek" streams ?
> 
> (In fact, I have to cast a php_ssh2_channel_stream)

Here you need to return the underlaying socket on which the ssh session
is established, so that the OS's select() can work on it. Look at
php_openssl_sockop_cast for an example.

Regards,

Arnaud

> 
> Thanks a lot.
> Regards,
> Samuel ROZE.
> 
> 
> 


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