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

Killian De Smedt killiands at gmail.com
Fri May 23 07:49:47 MDT 2014


Hi Exarkun,

I tried hacking the addWriter method as follows:
        add_writer_orig = reactor.__class__.addWriter #@UndefinedVariable
        def my_add_writer(self, writer):
            logging.warn(writer.__class__.__mro__)
            logging.warn(''.join(traceback.format_stack()))
            if isinstance(writer,Port):
                raise Exception("Shouldn't add a port as a writer")
            return add_writer_orig(self, writer)
        reactor.addWriter = types.MethodType(my_add_writer,reactor)
But I actually got nothing out of it. I also noticed this backtrace (or
similar) is sometimes with a Udp.Port, not only a Unix.Port:
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.udp.Port

 Any other ideas how I could find out the culprit?

Thank you,

Killian


On 7 May 2014 17:09, Killian De Smedt <killiands at gmail.com> wrote:

> Hi Exarkun,
>
> Thanks for the quick response. I should have specified those things
> immediately.
> I manually merged the UDP ipv6 branch in the trunk somewhere in august and
> used that one, the version number is reported as [twisted, version 13.1.0].
> The platform is always centos though the centos version might range from
> 5.x to 6.x, 32 bit, but most of the time it runs on a centos 5.2
> installation (kernel on my working machine is 2.6.18). Python is 2.7.1 .
>  I use the default reactor which should come down to the epoll one.
>
> I'll try to hack up the addwriter, it shouldn't be that hard to for just
> that application.
>
> Thank you,
>
> Killian
>
>
> On 7 May 2014 16:11, <exarkun at twistedmatrix.com> wrote:
>
>> On 01:47 pm, killiands at gmail.com wrote:
>>
>>> 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.
>>>
>>
>> I've seen something like this with a somewhat old version of Twisted and
>> a custom reactor.  I never tracked down the cause.
>>
>> What version of Twisted are you using, what platform are you on, and what
>> reactor are you using?
>>
>> Another useful bit of debug information would be to hack up the reactor's
>> `addWriter` method to do a check of the argument.  The call stack at *that*
>> point (when the argument is a Port) is more interesting than the call stack
>> at the point where `doWrite` is called.
>>
>> Jean-Paul
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>
>
>
> --
> Killian De Smedt
> mobile: +32 486/825 951
> mail: killiands at gmail.com
>



-- 
Killian De Smedt
mobile: +32 486/825 951
mail: killiands at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140523/e4571712/attachment.html>


More information about the Twisted-Python mailing list