[PECL-DEV] [ANNOUNCEMENT] mongo-1.6.12 (stable) Released.
The new PECL package mongo-1.6.12 (stable) has been released at http://pecl.php.net/. Release notes - ** Bug * [PHP-1494] - We don't allocate enough space for the hash buffer ** Task * [PHP-1474] - Declare no support for PHP 7 Package Info - This package provides an interface for communicating with the MongoDB database in PHP. Related Links - Package home: http://pecl.php.net/package/mongo Changelog: http://pecl.php.net/package-changelog.php?package=mongo Download: http://pecl.php.net/get/mongo-1.6.12.tgz Authors - Jeremy Mikola (lead) Derick Rethans(lead) Hannes Magnusson (lead) -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread in PHP7?
What do I do now? On Sun, 22 Nov 2015 11:42:45 +0500 Ruslan Osmanovwrote: > Hi, > > suppose we are using Zend API in a new thread (created by extension). > The problem that Zend API context(ZEND_TSRMLS_CACHE) is a thread-local > variable. > > I'm looking for a way to pass ZEND_TSRMLS_CACHE to my thread. I'm used > to use TSRMLS_FETCH_FROM_CTX(thread_data) and > TSRMLS_SET_CTX(thread_data) in previous PHP versions. Now, in PHP7 > they are not working - _tsrm_ls_cache is equal to zero within thread > function: > > (gdb) print _tsrm_ls_cache > void* 0x0 > > Well, as I've mentioned, I'm aware of that ZEND_TSRMLS_CACHE is a > thread-local variable. Probably, the OS kernel took care of keeping > thread-local data thread-local, and that's why I can't access the > "saved" thread context. > > But then how am I supposed to use Zend API working with ZTS in my own > thread? > > Thanks. > -- Ruslan Osmanov signature.asc Description: PGP signature
Re: [PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread in PHP7?
On Wed, 25 Nov 2015 18:45:48 +0100 "Anatol Belski"wrote: > Hi Ruslan, > > > -Original Message- > > From: Ruslan Osmanov [mailto:rrosma...@gmail.com] > > Sent: Wednesday, November 25, 2015 5:47 PM > > To: PECL Developers > > Subject: [PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread > > in PHP7? > > > > What do I do now? > > > > On Sun, 22 Nov 2015 11:42:45 +0500 > > Ruslan Osmanov wrote: > > > > > Hi, > > > > > > suppose we are using Zend API in a new thread (created by > > > extension). The problem that Zend API context(ZEND_TSRMLS_CACHE) > > > is a thread-local variable. > > > > > > I'm looking for a way to pass ZEND_TSRMLS_CACHE to my thread. I'm > > > used to use TSRMLS_FETCH_FROM_CTX(thread_data) and > > > TSRMLS_SET_CTX(thread_data) in previous PHP versions. Now, in PHP7 > > > they are not working - _tsrm_ls_cache is equal to zero within > > > thread function: > > > > > > (gdb) print _tsrm_ls_cache > > > void* 0x0 > > > > > > Well, as I've mentioned, I'm aware of that ZEND_TSRMLS_CACHE is a > > > thread-local variable. Probably, the OS kernel took care of > > > keeping thread-local data thread-local, and that's why I can't > > > access the "saved" thread context. > > > > > > But then how am I supposed to use Zend API working with ZTS in my > > > own thread? > > > > I'm not quite sure what exactly you're doing. > > If you need some data from another thread, you can pass it to your new > thread callback. It is correct, ZEND_TSRMLS_CACHE is thread local and > cannot be passed to another thread. But the data can be passed, > especially for the read only cases. And you also should ensure that > PHP request doesn't end while your thread is running. > > Regards > > Anatol I'll try to explain the problem. I have a function(let's call it `execF`), which is passed to a library(libeio) as a callback. This function is invoked afterwards by the library in separate thread. The function is calling Zend API, particularly ZVAL_STRINGL(). The Zend API uses TSRMLS_CACHE internally. For instance, ZVAL_STRINGL() allocates zend_string which implies using AG() macro. The AG() macro relies on TSRMLS_CACHE. Since TSRMLS_CACHE becomes invalid in new thread, the AG() macro (as well as other macros relying on TSRMLS_CACHE) fails with segmentation fault. -- Ruslan Osmanov signature.asc Description: PGP signature
RE: [PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread in PHP7?
Hi Ruslan, > -Original Message- > From: Ruslan Osmanov [mailto:rrosma...@gmail.com] > Sent: Wednesday, November 25, 2015 5:47 PM > To: PECL Developers> Subject: [PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread in > PHP7? > > What do I do now? > > On Sun, 22 Nov 2015 11:42:45 +0500 > Ruslan Osmanov wrote: > > > Hi, > > > > suppose we are using Zend API in a new thread (created by extension). > > The problem that Zend API context(ZEND_TSRMLS_CACHE) is a thread-local > > variable. > > > > I'm looking for a way to pass ZEND_TSRMLS_CACHE to my thread. I'm used > > to use TSRMLS_FETCH_FROM_CTX(thread_data) and > > TSRMLS_SET_CTX(thread_data) in previous PHP versions. Now, in PHP7 > > they are not working - _tsrm_ls_cache is equal to zero within thread > > function: > > > > (gdb) print _tsrm_ls_cache > > void* 0x0 > > > > Well, as I've mentioned, I'm aware of that ZEND_TSRMLS_CACHE is a > > thread-local variable. Probably, the OS kernel took care of keeping > > thread-local data thread-local, and that's why I can't access the > > "saved" thread context. > > > > But then how am I supposed to use Zend API working with ZTS in my own > > thread? > > I'm not quite sure what exactly you're doing. If you need some data from another thread, you can pass it to your new thread callback. It is correct, ZEND_TSRMLS_CACHE is thread local and cannot be passed to another thread. But the data can be passed, especially for the read only cases. And you also should ensure that PHP request doesn't end while your thread is running. Regards Anatol -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread in PHP7?
On 25/11/15 20:25, Ruslan Osmanov wrote: I'll try to explain the problem. I have a function(let's call it `execF`), which is passed to a library(libeio) as a callback. This function is invoked afterwards by the library in separate thread. The function is calling Zend API, particularly ZVAL_STRINGL(). The Zend API uses TSRMLS_CACHE internally. For instance, ZVAL_STRINGL() allocates zend_string which implies using AG() macro. The AG() macro relies on TSRMLS_CACHE. Since TSRMLS_CACHE becomes invalid in new thread, the AG() macro (as well as other macros relying on TSRMLS_CACHE) fails with segmentation fault. Why are you allocating a string? Are you expecting to later use it on the php request? What's the goal of your extension? I suspect you may have an earlier misstep. Regards -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PECL-DEV] Re: How do I save TSRMLS_CACHE for a new thread in PHP7?
On Wed, 25 Nov 2015 22:45:29 +0100 Ángel Gonzálezwrote: > On 25/11/15 20:25, Ruslan Osmanov wrote: > > I'll try to explain the problem. > > > > I have a function(let's call it `execF`), which is passed to a > > library(libeio) as a callback. This function is invoked afterwards > > by the library in separate thread. > > > > The function is calling Zend API, particularly ZVAL_STRINGL(). The > > Zend API uses TSRMLS_CACHE internally. For instance, ZVAL_STRINGL() > > allocates zend_string which implies using AG() macro. The AG() macro > > relies on TSRMLS_CACHE. > > > > Since TSRMLS_CACHE becomes invalid in new thread, the AG() macro (as > > well as other macros relying on TSRMLS_CACHE) fails with > > segmentation fault. > Why are you allocating a string? Are you expecting to later use it on > the php request? > What's the goal of your extension? I suspect you may have an earlier > misstep. I'm allocating a string for zend_fcall_info.function_name: https://goo.gl/MYoJcw (just like zend_call_method). Called by php_eio_custom_execute(). Well, I can pre-allocate zend_string for the callback. Then a few lines further I'm trying to fetch EG(function_table), which eventually refers to TSRMLS_CACHE. Since the latter is invalid, I catch a segmentation fault, again. So I'm asking how do I save the context for a thread created by libeio library. The flow looks like the following: 1. User passes a callable to eio_custom() 2. The callable is saved as libeio user custom data(void*): eio_custom(php_eio_custom_execute, pri, php_eio_res_cb_custom, eio_cb); 3. User calls eio_event_loop() 4. Libeio invokes php_eio_custom_execute() *in separate thread* 5. php_eio_custom_execute() unsuccessfully tries to use Zend API Thanks. -- Ruslan Osmanov signature.asc Description: PGP signature
[PECL-DEV] [ANNOUNCEMENT] pthreads-3.1.3 (stable) Released.
The new PECL package pthreads-3.1.3 (stable) has been released at http://pecl.php.net/. Release notes - fix gh issue #482 Package Info - A compatible Threading API for PHP Related Links - Package home: http://pecl.php.net/package/pthreads Changelog: http://pecl.php.net/package-changelog.php?package=pthreads Download: http://pecl.php.net/get/pthreads-3.1.3.tgz Authors - Joe Watkins(lead) -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PECL-DEV] PECL Account Request: leonardorifeli
Requested from: 177.83.223.78 Username: leonardorifeli Real Name:Leonardo Rifeli Email:leonardorif...@gmail.com (show address) Need php.net Account: yes Purpose: Use this account to resolve bugs and use in developer community Sponsor: The users of community To handle: http://pecl.php.net/admin/?acreq=leonardorifeli More info: Developer PHP and community developer -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PECL-DEV] VCS Account Request: leonardorifeli
Use this account to resolve bugs and use in developer community Sponsor: The users of community -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php