Re: Firebird - Who are WE ...

From: Date: Fri, 29 Mar 2019 12:58:53 +0000
Subject: Re: Firebird - Who are WE ...
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-105002@lists.php.net to get a copy of this message
On 29/03/2019 12:05, Joe Watkins wrote:
No, it's broken in both modes. In NTS mode, both the thread that handles events (which illegally calls user code) and the main thread are executing concurrently, they may both be calling functions that cause interaction with module globals, which are obviously shared between threads in NTS mode. You cannot just start threads and execute user code from anywhere, it's not safe in NTS mode and is a horrible violation of share nothing in ZTS mode. It's much more likely to break ZTS mode than NTS, but illegal in both.
The main problem here is that Firebird events are not something one is likely to use when running a web service? Which is why simply disabling the events functions would be my own fix in the absence of anybody coming forward to say they ARE using them. Asynchronous access to third party services is an area that does require a much more cooperative code base? Simply asking for a query to run, going off to do other activity, and returning when the result is available is the sort of activity we are talking about here? From the Firebird docs ...
The event notification is asynchronous and takes place at the end of the transaction in which the event was generated. A separate thread is created by TIBEvents to wait on the event notification. When the event occurs it calls the “OnEventAlert” event handler to report which event has been received. Note that the event handler is run in the context of the main thread and hence there is no need to worry about thread synchronisation.
So ibase_wait_event is sitting listening on the same connection that set the event handler and shares that connection which is where the current method of working comes from. But I have no idea if this can be changed. It is the firebird client which is actually holding the connection on which ibase_wait_event is listening. Using it depends very much on how PHP handles asynchronous events while I simply want to know that the read or write I've just done was successful or not ... -- Lester Caine - G8HFL ----------------------------- Contact - https://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - https://lsces.co.uk EnquirySolve - https://enquirysolve.com/ Model Engineers Digital Workshop - https://medw.co.uk Rainbow Digital Media - https://rainbowdigitalmedia.co.uk

« previous php.internals (#105002) next »