nonblocking_server assumes that socket.read returns exactly one message
-----------------------------------------------------------------------

                 Key: THRIFT-604
                 URL: https://issues.apache.org/jira/browse/THRIFT-604
             Project: Thrift
          Issue Type: Bug
          Components: Library (Ruby)
            Reporter: Oliver Kennedy


The Ruby implentation of NonblockingServer assumes that each socket read places 
at most one message into the buffer.  A flurry of several messages on the same 
socket (eg, oneway methods getting called in rapid succession) enqueue the 
messages into the buffer, but IOManager reads only one message per cycle 
through the event loop.  Since select() isn't aware of messages in the buffer, 
this causes the queue to steadily grow and lag further and further.

Specifically, NonblockingServer::IOManager.read_connection currently has lines 
that read:

> frame = slice_frame(@buffers[fd])
> if frame
> ....

These lines should instead read:

> while (frame = slice_frame!(@buffers[fd]))
> ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to