[Twisted-Python] doWrite called on a twisted.internet.unix.Port

Killian De Smedt killiands at gmail.com
Wed May 7 07:47:37 MDT 2014


Hello everybody,

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.

Unhandled Error
Traceback (most recent call last):
  File "/path/to/twisted.zip/twisted/python/log.py", line 88, in
callWithLogger

  File "/path/to/twisted.zip/twisted/python/log.py", line 73, in
callWithContext

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

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

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

  File "/path/to/twisted.zip/twisted/internet/base.py", line 1117, in
doWrite

exceptions.RuntimeError: doWrite called on a twisted.internet.unix.Port

I cannot reproduce the scenario where this goes wrong, in the application
there is only a single unix socket which is handled as follows:

class cmd_protocol(basic.Int32StringReceiver):
    def stringReceived(self, command):
        self.factory.callback(command, self.send_response)

    def send_response(self, code, message):
        self.sendString(response_msg(result_code = code, message =
message).SerializeToString()) //response_msg is a google protobuf class

class cmd_factory(protocol.ServerFactory):
    protocol = cmd_protocol
    def __init__(self, callback, *args, **kwargs):
        self.callback = callback

class cmd_server(object):
    def __init__(self, socket_file, callback, delete_previous_socket =
True):
        if delete_previous_socket:
            try:
                os.remove(socket_file)
            except OSError:
                pass
        reactor.listenUNIX(socket_file, cmd_factory(callback))
#@UndefinedVariable

Does anybody have any idea what could trigger the doWrite internally or how
I at least I can start debugging this?

Thank you,

Killian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140507/4584e5b4/attachment.html>


More information about the Twisted-Python mailing list