juhyunkwon / php-handlersocket

Automatically exported from code.google.com/p/php-handlersocket
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Find result will be lost if the value to be fetched is too long #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create a table with column (k,v)
2.insert a long value in v column , e.g. 5k bytes in my case
3. use executeSingle to get the value

The result is an empty array, so the 5k bytes is lost

This is due to socket receive length issue , in a busy server, sometimes you 
can 

only read 0 bytes from the server socket, but it's not a server error, you 

should try  to read again.

This fix would work

In handlersocket.c, function hs_response_recv

1284c1284,1287
<     ret  = php_stream_read(hs->stream, recv, size);

---
>     do{
>        ret  = php_stream_read(hs->stream, recv, size);
>     }while(ret==0);
> 

Original issue reported on code.google.com by pannin...@gmail.com on 7 Jul 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Thanks for this patch, I had an issue where I would only get the first few 
results with an IN query, and this fixed it. This really needs to be applied to 
the main repository so people don't lose a few hours wondering what's going on 
like I did :)

Original comment by blimb...@gmail.com on 31 Aug 2012 at 7:08

GoogleCodeExporter commented 9 years ago
I can confirm the same problem and that the suggested patch fixed it.  

We were pulling XML and block cache items out of the DB, many of which were 
easily 5k or more as suggested, some a fair bit smaller though.  In our case, 
the response array included only up to the field preceding the long field in 
the list of requested response fields.  All fields following the long field 
were dropped from the response.

+1 to pannin... for supplying the fix, saved hours of frustration.  Hopefully 
it can be included in a quick patch release soon?!?!

Original comment by kfarley...@gmail.com on 29 May 2013 at 10:32

GoogleCodeExporter commented 9 years ago
Just an update, although the patch got us from no results to some, it seems 
we're still getting truncated results roughly 1 in 10 times.

Original comment by kfarley...@gmail.com on 30 May 2013 at 12:56