Hi Arvind,

Can you open a JIRA for this bug if you haven't already?

Thanks,
-Todd

On Thu, Nov 26, 2009 at 2:41 PM, Arvind Sundararajan <[email protected]>wrote:

> On Thu, Nov 26, 2009 at 2:28 PM, Arvind Sundararajan <[email protected]>
> wrote:
> > I am encountering a bug while using TNonblockingServer on a service
> > with both oneway requests and synchronous requests.
> >
> > The implementation seems to start constructing a message in response
> > to a oneway request and then gives up once it realizes it is a oneway
> > request
> >
> >  def ready(self, all_ok, message):
> >
> > ....
> >        self.message = struct.pack('!i', len(message)) + message
> >        if len(message) == 0:
> >            # it was a oneway request, do not write answer
> >            self.status = WAIT_LEN
> >
> > On subsequent requests, I then get
> >
> > [TNonblockingServer.py :113 ] - 2009-11-26 13:58:01,829 - ERROR -
> > can't read frame size from socket
> >
> > because len(self.message) == 4 and _read_len is very defensive about
> > reading only the exact right amount of data from the socket.
> >
> > My patch is simple and seems to fix the problem:
> >
> >> svn diff
> > Index: lib/py/src/server/TNonblockingServer.py
> > ===================================================================
> > --- lib/py/src/server/TNonblockingServer.py     (revision 884669)
> > +++ lib/py/src/server/TNonblockingServer.py     (working copy)
> > @@ -182,6 +182,7 @@
> >         if len(message) == 0:
> >             # it was a oneway request, do not write answer
> >             self.status = WAIT_LEN
> > +            self.message = ''
> >         else:
> >             self.status = SEND_ANSWER
> >         self.wake_up()
> >
> > Could someone work with me to commit this?
> >
> > Arvind.
> >
>

Reply via email to