connect timeout does not work (library ignores the error)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmemcached |
Fix Released
|
Medium
|
Brian Aker |
Bug Description
Connect timeouts are not working (libmemcached 0.49, CentOS 5 / Ubuntu 11.04). Here's strace output with connect-timeout and poll-timeout both set to 50 milliseconds:
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(3, {sa_family=AF_INET, sin_port=
poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
sendto(3, "get test \r\n", 11, MSG_DONTWAIT|
recvfrom(3, 0x156a478, 8196, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
sendto(3, "get test \r\n", 11, MSG_DONTWAIT|
recvfrom(3, 0x156a478, 8196, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
sendto(3, "get test \r\n", 11, MSG_DONTWAIT|
recvfrom(3, 0x156a478, 8196, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
... repeating forever ...
Also, I noticed in the strace that an extra space character " " is being added to the "get" command before the CRLF.
The attached code uses a hard-coded IP address of "192.168.1.222", which should be changed to a dead IP if it is not already.
Changed in libmemcached: | |
status: | In Progress → Fix Committed |
Changed in libmemcached: | |
status: | Fix Committed → Fix Released |
The additional space is there to hide and particularly old, and annoying bug in memcached (which has not existed in a while)
On May 6, 2011, at 11:45 AM, Andrew Skalski wrote:
> ** Attachment added: "timeout-test.c" /bugs.launchpad .net/bugs/ 778777/ +attachment/ 2117301/ +files/ timeout- test.c /bugs.launchpad .net/bugs/ 778777 htons(11211) , sin_addr= inet_addr( "192.168. 1.222") }, 16) = -1 EINPROGRESS (Operation now in progress) MSG_NOSIGNAL, NULL, 0) = -1 EAGAIN (Resource temporarily unavailable) MSG_NOSIGNAL, NULL, 0) = -1 EAGAIN (Resource temporarily unavailable) MSG_NOSIGNAL, NULL, 0) = -1 EAGAIN (Resource temporarily unavailable)
> https:/
>
> --
> You received this bug notification because you are subscribed to
> libmemcached.
> https:/
>
> Title:
> connect timeout does not work (library ignores the error)
>
> Status in libmemcached - A C and C++ client library for memcached:
> New
>
> Bug description:
> Connect timeouts are not working (libmemcached 0.49, CentOS 5 / Ubuntu
> 11.04). Here's strace output with connect-timeout and poll-timeout
> both set to 50 milliseconds:
>
> socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
> fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
> fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> connect(3, {sa_family=AF_INET, sin_port=
> poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
> sendto(3, "get test \r\n", 11, MSG_DONTWAIT|
> recvfrom(3, 0x156a478, 8196, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
> poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
> sendto(3, "get test \r\n", 11, MSG_DONTWAIT|
> recvfrom(3, 0x156a478, 8196, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
> poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
> sendto(3, "get test \r\n", 11, MSG_DONTWAIT|
> recvfrom(3, 0x156a478, 8196, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
> poll([{fd=3, events=POLLOUT}], 1, 50) = 0 (Timeout)
> ... repeating forever ...
>
> Also, I noticed in the strace that an extra space character " " is
> being added to the "get" command before the CRLF.
>
> The attached code uses a hard-coded IP address of "192.168.1.222",
> which should be changed to a dead IP if it is not already.