vlog: Avoid calling worker_request() reentrantly.
authorBen Pfaff <blp@nicira.com>
Fri, 11 Jan 2013 01:14:03 +0000 (17:14 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 11 Jan 2013 04:00:43 +0000 (20:00 -0800)
commit7106bb5e7be0db6ca67c61a5fcb66fac2735c42c
tree986ad8e5a512b326d392823b31dc0f61a6dc5bea
parent989fd548031d532be32a10129e0c97d45fd98b9a
vlog: Avoid calling worker_request() reentrantly.

The following call stack was possible:

    vlog
        -> worker_request()
            -> poll_block()
                -> vlog
                     -> worker_request()

which caused problems because worker_request() is not reentrant.  In a
little more detail, the second worker_request() shoves its RPC protocol
data into the middle of the first.  This means that, first, you get
some binary crud in the log (the header for the second RPC).  And,
second, text from the first RPC log message gets treated by the worker
as the subsequent RPC's header.  That, in turn, typically causes the
worker to try to xmalloc() a huge number of bytes (0x20000000 or more,
since "space" has ASCII value 0x20), which causes the worker to die
with "virtual memory exhausted".  The main process then dies because
the worker's death closes the socket it uses to communicate with it
("connection reset").

Bug #14616.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
lib/vlog.c