codeigniter-redis icon indicating copy to clipboard operation
codeigniter-redis copied to clipboard

Adding fix for data sometimes not being read fully when below 8192 bytes...

Open integrii opened this issue 11 years ago • 9 comments

I think this is the fix to the issue I repoted. Issue #47

It was still possible for fread to not fully return all the requested data in one read when responses were less than 8192 bytes long.

integrii avatar Sep 27 '13 04:09 integrii

Thanks Eric. I'll merge this over the weekend. For the next time, could you make sure that you first pull in the changes and adhere to CodeIgniter's style guide? Thanks!

joelcox avatar Sep 27 '13 07:09 joelcox

I will. Sorry!

From: Joël Cox Sent: ‎Friday‎, ‎September‎ ‎27‎, ‎2013 ‎12‎:‎02‎ ‎AM To: joelcox/codeigniter-redis Cc: Eric Greer

Thanks Eric. I'll merge this over the weekend. For the next time, could you make sure that you first pull in the changes and adhere to CodeIgniter's style guide? Thanks!

— Reply to this email directly or view it on GitHub.

integrii avatar Sep 27 '13 07:09 integrii

Just wondering, did you run the unit tests before pushing? I'm getting sendSize is not defined (https://github.com/integrii/codeigniter-redis/blob/b4114e8ccf2cc04fd19716fb9c2d7ec3c4b9c46d/libraries/Redis.php#L196)

When I added $send_size = $value_length before the if clause, the unit tests stall.

On Sep 27, 2013, at 9:03 AM, Eric Greer [email protected] wrote:

I will. Sorry!

From: Joël Cox Sent: ‎Friday‎, ‎September‎ ‎27‎, ‎2013 ‎12‎:‎02‎ ‎AM To: joelcox/codeigniter-redis Cc: Eric Greer

Thanks Eric. I'll merge this over the weekend. For the next time, could you make sure that you first pull in the changes and adhere to CodeIgniter's style guide? Thanks!

— Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.

joelcox avatar Sep 27 '13 18:09 joelcox

I re-created these changes after finding what worked in my actual production copy. I would have copied over the production copy but it has debug stuff all over it. I will go in tonight, copy it out, remove the debug and commit to this pull request.

I am not the most careful coder at times. I tend to "fire for effect" because I come from a systems background.

On Fri, Sep 27, 2013 at 11:47 AM, Joël Cox [email protected] wrote:

Just wondering, did you run the unit tests before pushing? I'm getting sendSize is not defined ( https://github.com/integrii/codeigniter-redis/blob/b4114e8ccf2cc04fd19716fb9c2d7ec3c4b9c46d/libraries/Redis.php#L196)

When I added $send_size = $value_length before the if clause, the unit tests stall.

On Sep 27, 2013, at 9:03 AM, Eric Greer [email protected] wrote:

I will. Sorry!

From: Joël Cox Sent: ‎Friday‎, ‎September‎ ‎27‎, ‎2013 ‎12‎:‎02‎ ‎AM To: joelcox/codeigniter-redis Cc: Eric Greer

Thanks Eric. I'll merge this over the weekend. For the next time, could you make sure that you first pull in the changes and adhere to CodeIgniter's style guide? Thanks!

— Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/joelcox/codeigniter-redis/pull/48#issuecomment-25267823 .

integrii avatar Sep 27 '13 20:09 integrii

Haha :)

I guess your returns are always longer than the 8xxx limit, so you never run this branch. Thanks!

On Sep 27, 2013, at 10:01 PM, Eric Greer [email protected] wrote:

I re-created these changes after finding what worked in my actual production copy. I would have copied over the production copy but it has debug stuff all over it. I will go in tonight, copy it out, remove the debug and commit to this pull request.

I am not the most careful coder at times. I tend to "fire for effect" because I come from a systems background.

On Fri, Sep 27, 2013 at 11:47 AM, Joël Cox [email protected] wrote:

Just wondering, did you run the unit tests before pushing? I'm getting sendSize is not defined ( https://github.com/integrii/codeigniter-redis/blob/b4114e8ccf2cc04fd19716fb9c2d7ec3c4b9c46d/libraries/Redis.php#L196)

When I added $send_size = $value_length before the if clause, the unit tests stall.

On Sep 27, 2013, at 9:03 AM, Eric Greer [email protected] wrote:

I will. Sorry!

From: Joël Cox Sent: ‎Friday‎, ‎September‎ ‎27‎, ‎2013 ‎12‎:‎02‎ ‎AM To: joelcox/codeigniter-redis Cc: Eric Greer

Thanks Eric. I'll merge this over the weekend. For the next time, could you make sure that you first pull in the changes and adhere to CodeIgniter's style guide? Thanks!

— Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/joelcox/codeigniter-redis/pull/48#issuecomment-25267823 .

— Reply to this email directly or view it on GitHub.

joelcox avatar Sep 28 '13 07:09 joelcox

I actually have responses of all types. The problem was that I didn't take the file from production. I tried to hand re-create the fix it needed. Basically, data over 8192 would sometimes not fully be read when fread was called. I had an if condition in place that didn't do the fix for that when the data was shorter than 8192KB. I basically made sure that the code will read until all the expected data is in hand every time - not just for large replies.

My syntax is still not ad-hearing to any kind of syntax guide :-) If you link it to me I will come back on another pass.

This Redis.php file in my commit is currently running a steady 20 operations/second in a single persistent process that never ends. Data sizes from 0 bytes to 90Kb and growing. No errors anymore!

integrii avatar Sep 28 '13 08:09 integrii

Yay!

CI's style guide can be found here: http://ellislab.com/codeigniter/user-guide/general/styleguide.html

On Sep 28, 2013, at 10:08 AM, Eric Greer [email protected] wrote:

I actually have responses of all types. The problem was that I didn't take the file from production. I tried to hand re-create the fix it needed. Basically, data over 8192 would sometimes not fully be read when fread was called. I had an if condition in place that didn't do the fix for that when the data was shorter than 8192KB. I basically made sure that the code will read until all the expected data is in hand every time - not just for large replies.

My syntax is still not ad-hearing to any kind of syntax guide :-) If you link it to me I will come back on another pass.

This Redis.php file in my commit is currently running a steady 20 operations/second in a single persistent process that never ends. Data sizes from 0 bytes to 90Kb and growing. No errors anymore!

— Reply to this email directly or view it on GitHub.

joelcox avatar Sep 28 '13 08:09 joelcox

Hey, @integrii - had a chance to style-guide this up, yet? Been a few weeks since we've heard from you, so I wanted to check in real quick.

danhunsaker avatar Oct 14 '13 13:10 danhunsaker

I've been pushing hard on my own project deadlines recently. I haven't had enough time!

integrii avatar Oct 17 '13 01:10 integrii