Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-616

Transport should be reset on error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      I'm running a recent snapshot and observed the following problem when sending a message from Python: when an error is thrown after _oprot.writeMessageBegin and before _oprot.trans.flush, the data that has already been written remains in the transport's buffer. This seems to cause a deadlock in my case.

      The generated code currently looks like this:

      self._oprot.writeMessageBegin(...)
      # snip
      args.write(self._oprot)
      self._oprot.writeMessageEnd()
      self._oprot.trans.flush()
      

      Shouldn't it look like this?:

      try:
         self._oprot.writeMessageBegin(...)
         # snip
         self._oprot.writeMessageEnd()
         self._oprot.trans.flush()
      except:
         self._oprot.trans.reset()
         raise
      

      Where trans.reset() would clear the output buffer, for example in TBufferedTransport do "self.__wbuf = StringIO()".

      Am I missing something?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              julians37 Julian Scheid
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: