memcached_mget_execute might enter recursive calls that ends up with the call failing

Bug #490486 reported by JC Redoutey
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libmemcached
Fix Released
Medium
Brian Aker

Bug Description

Hi,

while testing Trond's new memcached_mget_execute feature (together with strict failure limit), binary mget always end up in disconnecting the server without retrieving all the data.

It appears to be caused by some king of infinite looping while trying to process responses to be given to the callback which triggers io_flushing which itself triggers response read try ...

#0 io_flush (ptr=0x6d0348, error=0x40001160) at memcached_io.c:424
#1 0x0000002a95675837 in memcached_io_write (ptr=0x6d0348, buffer=0x40001160, length=0, with_flush=1 '\001')
at memcached_io.c:325
#2 0x0000002a9567736f in memcached_response (ptr=0x6d0348, buffer=0x400011f0 "", buffer_length=350, result=0x6cc058)
at memcached_response.c:48
#3 0x0000002a956756ac in io_flush (ptr=0x6d0348, error=0x400013c0) at memcached_io.c:127
#4 0x0000002a95675837 in memcached_io_write (ptr=0x6d0348, buffer=0x40001160, length=0, with_flush=1 '\001')
at memcached_io.c:325
#5 0x0000002a9567736f in memcached_response (ptr=0x6d0348, buffer=0x40001450 "", buffer_length=350, result=0x6cc058)
at memcached_response.c:48
#6 0x0000002a956756ac in io_flush (ptr=0x6d0348, error=0x40001620) at memcached_io.c:127
#7 0x0000002a95675837 in memcached_io_write (ptr=0x6d0348, buffer=0x40001160, length=0, with_flush=1 '\001')
at memcached_io.c:325
#8 0x0000002a9567736f in memcached_response (ptr=0x6d0348, buffer=0x400016b0 "", buffer_length=350, result=0x6cc058)
at memcached_response.c:48
[...]

The fix I have is similar to the purging, ie flagging when were trying to process the input buffer to prevent entering the deadly loop.
I must admit this is some kind of tricky to follow the path through i/o related code so I am not sure this fixes all the cases, but at least mine ;-)

Related branches

Revision history for this message
Brian Aker (brianaker) wrote :

A test case was added for this a while ago.

Thanks

Changed in libmemcached:
assignee: nobody → Brian Aker (brianaker)
importance: Undecided → Medium
status: New → Fix Committed
Brian Aker (brianaker)
Changed in libmemcached:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.