'delete noreply' may hang the client
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmemcached |
Fix Released
|
Undecided
|
Trond Norbye |
Bug Description
I use libmemcached v0.30 in noreply mode. And find that bug: in case
of deleting of a large amount of keys from memcached my production
server start waiting for a while on read().
This behaviour is reproducing in the test environment each time but i
can't reproduce it in the libmemcached unit tests.
Version v0.31 ans 0.32 have the same behaviour.
If I use libmemcached in usual mode (noreply is off) this thing does
not happened.
(gdb) bt
#0 0x00007f0f9ca8758b in read () from /lib/libpthread
#1 0x00000000006808e3 in memcached_io_read (ptr=0x4e2b5720,
buffer=
memcached_io.c:108
#2 0x0000000000681490 in memcached_
buffer_
#3 0x000000000068330d in textual_
buffer=
at memcached_
#4 0x0000000000682ccb in memcached_
buffer=
at memcached_
#5 0x0000000000681841 in memcached_purge (ptr=0x4e2b5720) at
memcached_
#6 0x00000000006810a3 in io_flush (ptr=0x4e2b5720,
error=0x7f0f9bd
#7 0x0000000000680c87 in memcached_io_write (ptr=0x4e2b5720,
buffer=
memcached_io.c:241
#8 0x000000000067e040 in memcached_do (ptr=0x4e2b5720,
command=
memcached_do.c:26
#9 0x000000000067dc7e in memcached_
master_
key=0x7f0f9bd744b0 "1:206384:48",
key_length=11, expiration=0) at memcached_
#10 0x000000000067d970 in memcached_delete (ptr=0x4e2b5490,
key=0x7f0f9bd744b0 "1:206384:48", key_length=11, expiration=0) at
memcached_
(gdb) up 5
#5 0x0000000000681841 in memcached_purge (ptr=0x4e2b5720) at
memcached_
56 result_ptr);
Current language: auto; currently c
(gdb) l memcached_
30 }
31 WATCHPOINT_
32
33 uint32_t no_msg= memcached_
34 if (no_msg > 0)
35 {
36 memcached_result_st result;
37 memcached_result_st *result_ptr;
38 char buffer[
39
(gdb) l memcached_
51 for (x= 0; x < no_msg; x++)
52 {
53 memcached_
54 memcached_return rc= memcached_
55 sizeof (buffer),
56 result_ptr);
57 /*
58 * Purge doesn't care for what kind of command results that
is received.
59 * The only kind of errors I care about if is I'm out of sync with the
60 * protocol or have problems reading data from the network..
(gdb) p no_msg
$5 = 4294967295
(gdb) p (uint)-1
$6 = 4294967295
memcached_delete() try purge pending responses but there is nothing
(i.e. memcached_
--- libmemcached-
22:08:20.000000000 +0400
+++ libmemcached-
19:42:08.000000000 +0400
@@ -30,8 +30,8 @@
}
WATCHPOINT_
- uint32_t no_msg= memcached_
- if (no_msg > 0)
+ uint32_t no_msg= memcached_
+ if (no_msg-- > 1)
{
memcached_
memcached_
Related branches
- Brian Aker: Needs Fixing
-
Diff: 1146 lines7 files modifiedclients/memcapable.c (+714/-41)
libmemcached/memcached_delete.c (+1/-1)
libmemcached/memcached_get.c (+5/-2)
libmemcached/memcached_purge.c (+1/-1)
libmemcached/memcached_response.c (+7/-1)
libmemcached/memcached_stats.c (+2/-2)
tests/function.c (+154/-0)
Hmm.. this is strange.. I tried to add the following test-case to recreate the problem:
static test_return regression_ bug_442914( memcached_ st *memc) behavior_ set(memc, MEMCACHED_ BEHAVIOR_ BUFFER_ REQUESTS, 1); behavior_ set(memc, MEMCACHED_ BEHAVIOR_ NOREPLY, 1);
{
memcached_return rc;
rc= memcached_
assert(rc == MEMCACHED_SUCCESS);
rc= memcached_
assert(rc == MEMCACHED_SUCCESS);
for (int x= 0; x < 20000; ++x) delete( memc, k, len, 0); BUFFERED) ;
{
char k[251];
size_t len= snprintf(k, sizeof(k), "%u", x);
rc= memcached_
assert(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_
}
return TEST_SUCCESS;
}
But the test succeeds with or without buffered mode...