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

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

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

@ -503,7 +503,7 @@ def set_cloexec(fd):
:func:`mitogen.fork.on_fork`.
"""
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)
@ -808,7 +808,7 @@ class Message(object):
self.src_id = mitogen.context_id
self.auth_id = mitogen.context_id
vars(self).update(kwargs)
assert isinstance(self.data, BytesType)
assert isinstance(self.data, BytesType), 'Message data is not Bytes'
def pack(self):
return (
@ -1834,7 +1834,8 @@ class DelimitedProtocol(Protocol):
if cont:
self.on_partial_line_received(self._trailer)
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)
def on_line_received(self, line):

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

Loading…
Cancel
Save