Comment #9 on issue 106 by [email protected]: binary protocol parsing can cause memcached server lockup
http://code.google.com/p/memcached/issues/detail?id=106

The recvfom() use 0 as SIZE and NULL as BUFFER. According to manual, that call will consume the incoming packet. Without it, epoll_wait() will always return immediately because the UDP socket is still in readable state.


 -- Function: int recvfrom (int SOCKET, void *BUFFER, size_t SIZE, int
          FLAGS, struct sockaddr *ADDR, socklen_t *LENGTH-PTR)
     The `recvfrom' function reads one packet from the socket SOCKET
     into the buffer BUFFER.  The SIZE argument specifies the maximum
     number of bytes to be read.

     If the packet is longer than SIZE bytes, then you get the first
     SIZE bytes of the packet and the rest of the packet is lost.
     There's no way to read the rest of the packet.  Thus, when you use
     a packet protocol, you must always know how long a packet to
     expect.


Reply via email to