On Fri, Mar 18, 2011 at 2:07 AM, Mark Slee <[email protected]> wrote: > This is the expected behavior with the single-threaded PHP server. > > > It seems as though subsequent "oneway" calls block each other and happen > in > > a synchronized fashion - the first call does happen asynchronously and > out > > of order though ! > > I don't see anything "out of order" in the data you've provided. The > semantics of "oneway" are really client semantics. It means that the client > will send the request to the server and not wait to hear anything back > (because the server won't send anything back). > > All the call to $client->test(1) does is write out the request. Client > execution then continues immediately. > Thanks Mark, that helped !
Cheers, > mcslee > > -----Original Message----- > From: David Reiss [mailto:[email protected]] > Sent: Thursday, March 17, 2011 1:32 PM > To: [email protected] > Cc: Souvik Roy > Subject: Re: "oneway" doesn't seem to work with PHP > > Are you using an http-based server? http doesn't support one-way messages, > so oneway thrift calls always wait for the (empty) http response. > > --David > > On 03/17/2011 01:30 PM, Souvik Roy wrote: > > Thanks for the reply Bryan. I did search JIRA, but no such bugs have been > > reported yet. > > I took a closer look into the functionality and found out something which > I > > wasn't expecting. > > It seems as though subsequent "oneway" calls block each other and happen > in > > a synchronized fashion - the first call does happen asynchronously and > out > > of order though ! > > Consider the following code (based on the previous code snippet); > > > > //Server snippet > > *public function test($test_bigint){ > > echo 'before sleep '. $test_bigint; > > sleep(10); > > echo 'after sleep '. $test_bigint; > > }* > > > > If I call the above as: > > *echo "Start"; > > $client->test(1); > > echo "Done"; > > $client->test(2);* > > > > The output of the above is: > > *Start > > Done > > before sleep1 > > after sleep1 > > before sleep2 > > after sleep2* > > > > I wonder if this was "meant to be" this way? All I'm trying is to execute > a > > method multiple times, in parallel. This can be achieved with threads in > > other languages, but I was wondering if "oneway" methods can help me in > PHP > > here. > > > > Cheers! > > > > On Thu, Mar 17, 2011 at 10:13 PM, Bryan Duxbury <[email protected]> > wrote: > >> Sounds like a bug to me. I'm not aware of any existing issue, but you > > might > >> want to do a search in our JIRA. > >> > >> On Thu, Mar 17, 2011 at 8:59 AM, Souvik Roy <[email protected]> > wrote: > >> > >>> Hi > >>> I'm aware that PHP doesn't have threading support yet, hence a > >>> MultiThreaded thrift server is not possible with Thrift in PHP > >>> (right?). But I was under an impression than "oneway" asynchronous > >>> functions do work with Thrift - PHP:server. But that doesn't seem to > >>> be the case. To reproduce it, I wrote a small function defined as > >>> follows: > >>> > >>> //Server snippet > >>> public function test($test_bigint){ > >>> echo 'before sleep '. $test_bigint; > >>> sleep(10); > >>> echo 'after sleep '. $test_bigint; > >>> } > >>> > >>> //Client snippet > >>> for($i=0;$i<10;$i++){ > >>> $client->test($i); > >>> } > >>> > >>> //Thrift IDL > >>> service someservice{ > >>> oneway void test(1:i64 test_bigint) > >>> } > >>> > >>> Ideally, the above should be executed asynchronously and should not > >>> wait for the function to finish execution (and print "before sleep"$i > >>> all through the iterated times at first). But the actual output waits > >>> for sleep(10) and is executed synchronously. > >>> Is this a known feature Bug? If this topic has been already discussed > >>> earlier, can anyone please point me to the thread URL ? > >>> > >>> Thanks > >>> -- > >>> Souvik Roy > >>> http://www.souvikroy.com > >>> > >> > > > > > > > -- Souvik Roy http://www.souvikroy.com
