You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Aiden Scandella (JIRA)" <ji...@apache.org> on 2014/12/17 01:36:13 UTC

[jira] [Updated] (THRIFT-2900) Python THttpClient does not reset socket timeout on exception

     [ https://issues.apache.org/jira/browse/THRIFT-2900?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aiden Scandella updated THRIFT-2900:
------------------------------------
    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}}

  was:
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`


> Python THttpClient does not reset socket timeout on exception
> -------------------------------------------------------------
>
>                 Key: THRIFT-2900
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2900
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library
>    Affects Versions: 0.9.2
>            Reporter: Aiden Scandella
>
> 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}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)