Changeset 630

Show
Ignore:
Timestamp:
11/12/07 17:48:54 (1 year ago)
Author:
sgrimm
Message:

Always send "SERVER_ERROR out of memory" when memory exhausted.
Before the fix the code tried to append "END\r\n" to whatever there
was in the buffer, which may produce bogus result because the buffer
might not end in "\r\n". Also the result of add_iov() wasn't tested.
(Patch from Tomash Brechko, <tomash.brechko@gmail.com>)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/ChangeLog

    r629 r630  
     12007-11-12  Steven Grimm  <sgrimm@facebook.com> 
     2 
     3        * Patch from Tomash Brechko <tomash.brechko@gmail.com>: Always send 
     4          "SERVER_ERROR out of memory" when memory exhausted. 
     5 
    162007-10-15  Paul Lindner  <lindner@inuus.com> 
    27 
  • trunk/server/memcached.c

    r629 r630  
    11911191    if (settings.verbose > 1) 
    11921192        fprintf(stderr, ">%d END\n", c->sfd); 
    1193     add_iov(c, "END\r\n", 5); 
    1194  
    1195     if (c->udp && build_udp_headers(c) != 0) { 
     1193 
     1194 Â Â Â /* 
     1195 Â Â Â Â Â If the loop was terminated because of out-of-memory, it is not 
     1196 Â Â Â Â Â reliable to add END\r\n to the buffer, because it might not end 
     1197 Â Â Â Â Â in \r\n.  So we send SERVER_ERROR instead. 
     1198 Â Â Â */ 
     1199 Â Â Â if (key_token->value != NULL || add_iov(c, "END\r\n", 5) != 0 
     1200 Â Â Â Â Â Â Â || (c->udp && build_udp_headers(c) != 0)) { 
    11961201        out_string(c, "SERVER_ERROR out of memory"); 
    11971202    }