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

Python THttpClient does not reset socket timeout on exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.2
    • 0.9.3
    • Python - Library
    • None

    Description

      https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=lib/py/src/transport/THttpClient.py;h=ea80a1ae875865a297a7b14dad15757e3933284f;hb=HEAD#l106

      102 def __withTimeout(f):
      103 def _f(*args, **kwargs):
      104 orig_timeout = socket.getdefaulttimeout()
      105 socket.setdefaulttimeout(args[0].__timeout)
      106 result = f(*args, **kwargs)
      107 socket.setdefaulttimeout(orig_timeout)
      108 return result
      109 return _f

      if f raises, the default timeout is not reset. Should be wrapped in a try/finally

      Attachments

        1. THRIFT-2900.patch
          0.6 kB
          Aiden Scandella

        Activity

          People

            jensg Jens Geyer
            aiden Aiden Scandella
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: