Ok, I've prepared

 

http://twistedmatrix.com/trac/attachment/ticket/1918/kqueue.patch

 

which passes all tests (FreeBSD 8.3 p3 i386 / Python 2.7.1) but the ones related to open FDs (which are unrelated to the reactor stuff).

 

This works for me for FreeBSD .. I've tried on MacOSX .. there seem to be PTY issues there. Well.

 

I've also updated the

 

http://pypi.python.org/pypi/txkqreactor/0.2

 

for anyone who wants to try before this gets eventually merged into Twisted.

 

 

Von: twisted-python-bounces@twistedmatrix.com [mailto:twisted-python-bounces@twistedmatrix.com] Im Auftrag von Glyph Lefkowitz
Gesendet: Sonntag, 6. November 2011 22:13
An: Twisted general discussion
Betreff: Re: [Twisted-Python] kqueue reactor / ticket #1918

 

 

On Nov 5, 2011, at 1:46 PM, Tobias Oberstein wrote:



Then, baseline. I've run the trial using select reactor in the

expectation of finding all tests passed.

 

This is not the case, there are a couple of failed ones. Those are

also failed with the kqueue reactor, so I need to know whether I need

to inspect those or those are problems unrelated to the reactor, but of

general (platform?) nature.

 

Are you using Twisted 11? Many of these issues are, if I'm not mistaken,

fixed in trunk (though perhaps not all). So trunk is probably a better baseline

to work off of.


Ok, I'm using trunk now.

1)
The errors in

twisted.python.test.test_components

are gone.

2)
The errors in

twisted.internet.test.test_posixprocess
twisted.internet.test.test_process

are still there ... and they show up for select, poll and kqueue reactors.

They all somehow relate to "open FDs":

twisted.internet.test.test_posixprocess
 FileDescriptorTests
   test_expectedFDs ...                                                 [FAIL]

twisted.internet.test.test_process
 PTYProcessTestsBuilder_KQueueReactor
   test_openFileDescriptors ...                                        [ERROR]
 PTYProcessTestsBuilder_PollReactor
   test_openFileDescriptors ...                                        [ERROR]
 PTYProcessTestsBuilder_SelectReactor
   test_openFileDescriptors ...                                        [ERROR]
ProcessTestsBuilder_SelectReactor
   test_openFileDescriptors ...                                        [ERROR]

This might more a FreeBSD related thing. ?

 

Yes.

 

These tests should pass; I am guessing this has something to do with the still-open ticket <http://tm.tl/4747>.  Maybe have a look at fixing that?

 

You might be able to work around it on your system this by mounting fdescfs at /dev/fd.  (This really ought to be the default, please bother someone in FreeBSD-land to make it so. :)).

 

It would be useful to include tracebacks with the errors.  "trial --rterrors" is useful, as it includes the tracebacks  especially if you are experiencing hanging with the tests.



3)
I think I've nailed down the Half-Close stuff.

 

Awesome.  Do you have a link to a changeset for that?  (Did I miss it earlier in the thread?)



4)
These are kqueue specific. Need to investigate further.

 

These are the ones to focus on for <http://tm.tl/1918>, then :).



twisted.internet.test.test_fdset
 ReactorFDSetTestsBuilder_KQueueReactor
   test_lostFileDescriptor ...                                         [ERROR]
   test_removedFromReactor ...                                          [FAIL]

The first one comes up, since

removeReader()

is called for a FD which is gone,  and leads to a socket exception from fd = reader.fileno()

 

It sounds like you've narrowed this down pretty far!  Good work.



5)
These are kqueue specific. Need to investigate further.

twisted.conch.test.test_conch

The fail on the kqeue control call .. see below.

Any ideas what could be the reason?

 

I would suggest fixing the issues you outlined in point 4 first.  It's really unfortunate that reactor issues are being caught by conch tests.  The reactor tests should be comprehensive enough to catch everything in the reactor.

 

This may just be a side-effect of the other errors you're tracking down, so see if you can fix those, and then loop back to these.  If they disappear, then great.  If not, then we should have a test that specifically tests this functionality and doesn't rely on weird and difficult to diagnose errors in conch to find them.

 

Thanks again for working on this!

 

-glyph