<div dir="ltr">Hello everybody,<br><br>I sometimes see the following error logged by a twisted application, it only happens sporadically and I cannot even reproduce when trying to re-execute the exact sequence of those failures. So giving an SSCCE is quite impossible for now (sorry). Given this trace it's also hard to find what was actually called/executed.<br clear="all">

<div><br><span style="font-family:courier new,monospace">Unhandled Error<br>Traceback (most recent call last):<br>  File "/path/to/twisted.zip/twisted/python/log.py", line 88, in callWithLogger<br>    <br>  File "/path/to/twisted.zip/twisted/python/log.py", line 73, in callWithContext<br>

    <br>  File "/path/to/twisted.zip/twisted/python/context.py", line 118, in callWithContext<br>    <br>  File "/path/to/twisted.zip/twisted/python/context.py", line 81, in callWithContext<br>    <br>

--- <exception caught here> ---<br>  File "/path/to/twisted.zip/twisted/internet/posixbase.py", line 619, in _doReadOrWrite<br>    <br>  File "/path/to/twisted.zip/twisted/internet/base.py", line 1117, in doWrite<br>

    <br>exceptions.RuntimeError: doWrite called on a twisted.internet.unix.Port<br><br></span></div><div><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif">I cannot reproduce the scenario where this goes wrong, in the application there is only a single unix socket which is handled as follows:</font><br>

<br>class cmd_protocol(basic.Int32StringReceiver):<br>    def stringReceived(self, command):<br>        self.factory.callback(command, self.send_response)<br><br>    def send_response(self, code, message):<br>        self.sendString(response_msg(result_code = code, message = message).SerializeToString()) //response_msg is a google protobuf class<br>

<br>class cmd_factory(protocol.ServerFactory):<br>    protocol = cmd_protocol<br>    def __init__(self, callback, *args, **kwargs):<br>        self.callback = callback<br><br>class cmd_server(object):<br>    def __init__(self, socket_file, callback, delete_previous_socket = True):<br>

        if delete_previous_socket:<br>            try:<br>                os.remove(socket_file)<br>            except OSError:<br>                pass<br>        reactor.listenUNIX(socket_file, cmd_factory(callback)) #@UndefinedVariable<br>

<br></span></div><div><span style="font-family:arial,helvetica,sans-serif">Does anybody have any idea what could trigger the doWrite internally or how I at least I can start debugging this?<br><br></span></div><div><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif">Thank you,<br>

<br></span></span></div><div><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif">Killian</span><br></span>
</div></div>