Skip to content

Commit

Permalink
Make sure RemoteFunc does crash (and cause thread to freeze) if some …
Browse files Browse the repository at this point in the history
…HTTP exception occurs while performing the call
  • Loading branch information
tuomas2 committed Jul 22, 2016
1 parent 95d822d commit 38cf8a8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/automate/callables/builtin_callables.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
from builtins import bytes

import datetime

from future import standard_library

standard_library.install_aliases()

from http.client import HTTPException

import re
import threading
import xmlrpc.client
Expand Down Expand Up @@ -1082,6 +1086,7 @@ def call(self, caller=None, **kwargs):
return ''



class RemoteFunc(AbstractCallable):

"""
Expand All @@ -1106,9 +1111,9 @@ def call(self, caller, **kwargs):
_kwargs = {k: self.call_eval(v, caller, **kwargs) for k, v in list(self._kwargs.items())}
try:
return getattr(server, funcname)(*args, **_kwargs)
except xmlrpc.client.Fault as e:
self.logger.error(
'Could call remote function (%s,%s)(*%s, **%s), error: %s', server, funcname, args, _kwargs, e)
except (xmlrpc.client.Fault, HTTPException) as e:
self.logger.exception(
'Exception occurred in remote function call (%s,%s)(*%s, **%s), error: %s', server, funcname, args, _kwargs, e)
except (socket.gaierror, IOError, xmlrpc.client.Fault) as e:
self.logger.error('Could call remote function, error: %s', e)

Expand Down

0 comments on commit 38cf8a8

Please sign in to comment.