issue #646: add extra logging to assertions and start_child()

new-serialization
David Wilson 5 years ago
parent 3023ab3b7b
commit be4f1bdb50

@ -347,6 +347,7 @@ class ContextService(mitogen.service.Service):
) )
def _send_module_forwards(self, context): def _send_module_forwards(self, context):
if hasattr(self.router.responder, 'forward_modules'):
self.router.responder.forward_modules(context, self.ALWAYS_PRELOAD) self.router.responder.forward_modules(context, self.ALWAYS_PRELOAD)
_candidate_temp_dirs = None _candidate_temp_dirs = None

@ -503,7 +503,7 @@ def set_cloexec(fd):
:func:`mitogen.fork.on_fork`. :func:`mitogen.fork.on_fork`.
""" """
flags = fcntl.fcntl(fd, fcntl.F_GETFD) flags = fcntl.fcntl(fd, fcntl.F_GETFD)
assert fd > 2 assert fd > 2, 'fd %r <= 2' % (fd,)
fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC) fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC)
@ -808,7 +808,7 @@ class Message(object):
self.src_id = mitogen.context_id self.src_id = mitogen.context_id
self.auth_id = mitogen.context_id self.auth_id = mitogen.context_id
vars(self).update(kwargs) vars(self).update(kwargs)
assert isinstance(self.data, BytesType) assert isinstance(self.data, BytesType), 'Message data is not Bytes'
def pack(self): def pack(self):
return ( return (
@ -1834,7 +1834,8 @@ class DelimitedProtocol(Protocol):
if cont: if cont:
self.on_partial_line_received(self._trailer) self.on_partial_line_received(self._trailer)
else: else:
assert stream.protocol is not self assert stream.protocol is not self, \
'stream protocol is no longer %r' % (self,)
stream.protocol.on_receive(broker, self._trailer) stream.protocol.on_receive(broker, self._trailer)
def on_line_received(self, line): def on_line_received(self, line):

@ -1680,6 +1680,7 @@ class Connection(object):
try: try:
self.proc = self.start_child() self.proc = self.start_child()
except Exception: except Exception:
LOG.debug('failed to start child', exc_info=True)
self._fail_connection(sys.exc_info()[1]) self._fail_connection(sys.exc_info()[1])
return return

Loading…
Cancel
Save