Opened 11 years ago

Last modified 11 years ago

#5418 defect new

twisted.internet.test.test_tcp.AbortConnectionTestCase_EPollReactor.test_fullWriteBufferAfterByteExchange fails on Python 2.5 on 32 bit Ubuntu Hardy

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author:

Description

Seen on BuildBot:

[ERROR]
Traceback (most recent call last):
  File "/var/lib/buildbot/bot-glyph-3/hardy32-python2.5-select/Twisted/twisted/internet/test/test_tcp.py", line 1766, in test_fullWriteBufferAfterByteExchange
    EventualNoReadServer)
  File "/var/lib/buildbot/bot-glyph-3/hardy32-python2.5-select/Twisted/twisted/internet/test/test_tcp.py", line 1653, in runAbortTest
    self.runReactor(reactor, timeout=10)
  File "/var/lib/buildbot/bot-glyph-3/hardy32-python2.5-select/Twisted/twisted/internet/test/reactormixins.py", line 206, in runReactor
    "reactor still running after %s seconds" % (timeout,))
twisted.internet.defer.TimeoutError: reactor still running after 10 seconds

twisted.internet.test.test_tcp.AbortConnectionTestCase_EPollReactor.test_fullWriteBufferAfterByteExchange

It may also fail on other platforms.

Change History (1)

comment:1 Changed 11 years ago by Jean-Paul Calderone

Some minimal investigation into this suggests that the problem is just that the test cannot reliably complete within the 10 second timeout imposed on it. Sometimes getting through the write loop takes almost the full 10 seconds, particularly when the particular slave this failure was observed on is busy with other tasks (like running other build slaves).

The loop:

       self.transport.registerProducer(self, True)
        for i in range(100):
            self.transport.write("1234567890" * 32000)

seems excessive to me. The code is trying to full up the socket send buffer. 30MB is more than enough to accomplish that. For example, on Linux:

>>> s.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF)
16384

I'm sure other platforms make different decisions about the size of the send buffer, but I doubt anyone uses anything anywhere near 30MB.

This program suggests that a limit closer to 128kB should be sufficient on Linux, or 64kB on Windows:

from socket import socket
from time import sleep
p = socket()
p.bind(("", 0))
p.listen(3)
c = socket()
c.setblocking(False)
c.connect_ex(('127.0.0.1', p.getsockname()[1]))
s, _ = p.accept()
i = 0
while True:
    try:
        c.send("x")
        i += 1
    except Exception, e:
        print i, e
        break

I suggest adopting twice this value as the quantity of bytes to write out in this test. This complicated by the SSL version of the tests, though, which do not trigger pauseProducing with this little data. It looks like about 16MB must be written to trigger pauseProducing on SSL. That strikes me as a lot.

Note: See TracTickets for help on using tickets.