memcached_mget_execute might enter recursive calls that ends up with the call failing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmemcached |
Fix Released
|
Medium
|
Brian Aker |
Bug Description
Hi,
while testing Trond's new memcached_
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_
#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_
#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_
[...]
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
- Libmemcached-developers: Pending requested
-
Diff: 162 lines (+92/-3)4 files modifiedlibmemcached/memcached.h (+1/-0)
libmemcached/memcached_io.c (+5/-0)
libmemcached/memcached_response.c (+1/-1)
tests/function.c (+85/-2)
Changed in libmemcached: | |
status: | Fix Committed → Fix Released |
A test case was added for this a while ago.
Thanks