Merge lp://staging/~bac/python-memcached/bug-974632 into lp://staging/python-memcached

Proposed by Brad Crittenden
Status: Needs review
Proposed branch: lp://staging/~bac/python-memcached/bug-974632
Merge into: lp://staging/python-memcached
Diff against target: 59 lines (+16/-5)
1 file modified
memcache.py (+16/-5)
To merge this branch: bzr merge lp://staging/~bac/python-memcached/bug-974632
Reviewer Review Type Date Requested Status
Sean Reifschneider Disapprove
Review via email: mp+101148@code.staging.launchpad.net

Description of the change

Restore the previous behavior of readline() so that it returns None if the socket is closed. A new internal method _readline() is introduced to provide the uncaught _ConnectionDeadError exception for the places that wish to catch it and do a retry.

To post a comment you must log in.
Revision history for this message
Sean Reifschneider (jafo) wrote :

I think this misses some cases that the current could would also raise an exception in. This is a good start, and helped me understand the problem, thanks for the patch, but I've made some other changes which include restoring the readline() back to not raising an exception in most cases, and the _unsafe_*() functions calling functions which explicitly request that readline() raise the exception.

I'm going to commit a change shortly, would you mind reviewing it and seeing if it fixes the issue?

Thanks,
Sean

review: Disapprove
Revision history for this message
Brad Crittenden (bac) wrote :

Hi Sean, thanks for looking at this code.

Your comment confuses me a little because the approach you describe as your preferred solution seems to be what I've implemented, that is the readline() method is restored to never throw an exception while the unsafe do call a special method that can raise the exception. I called this new method _readline(), which could've been named better.

Perhaps there are call sites that use _expectvalue that I missed?

Anyway, I'll be happy to review the patch you produce.

Revision history for this message
Sean Reifschneider (jafo) wrote :

On 04/11/2012 04:37 AM, Brad Crittenden wrote:
> Your comment confuses me a little because the approach you describe

I guess the simplest explanation I can give is that my patches changes the
semantics back to how they were before Tarek's patch -- exceptions aren't
raised by that code. Only in the cases where the higher-level code
explicitly requests the exceptions are they generated.

I don't recall exactly what I saw that I thought might still leak
exceptions, but it just "felt right" this way, basically reverting to the
old behavior, regarding exception generation.

Thoughts?

Thanks,
Sean

Unmerged revisions

57. By Brad Crittenden

Provide a wrapper to handled _ConnectionDeadErrors so that readline() behaves as before.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches