Opened 4 years ago

Closed 3 years ago

#4331 defect closed fixed (fixed)

SIGCHLD causes "Interrupted system call" errors on Python 2.4, in a fresh SVN checkout

Reported by: TimAllen Owned by:
Priority: normal Milestone:
Component: core Keywords: easy
Cc: spiv, exarkun Branch:
Author: Launchpad Bug:

Description

Apparently this is a regression from #733.

From a fresh git svn checkout of r28580 on my Python 2.4-based system, when I run bin/trial twisted/ I get the following errors:

===============================================================================
[FAIL]: twisted.internet.test.test_process.PTYProcessTestsBuilder_SelectReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 219, in test_systemCallUninterruptedByChildExit
    self.assertEqual(result, ["Foo\n"])
twisted.trial.unittest.FailTest: not equal:
a = []
b = ['Foo\n']

===============================================================================
[FAIL]: twisted.internet.test.test_process.ProcessTestsBuilder_PollReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 219, in test_systemCallUninterruptedByChildExit
    self.assertEqual(result, ["Foo\n"])
twisted.trial.unittest.FailTest: not equal:
a = []
b = ['Foo\n']

===============================================================================
[FAIL]: twisted.internet.test.test_process.ProcessTestsBuilder_SelectReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 219, in test_systemCallUninterruptedByChildExit
    self.assertEqual(result, ["Foo\n"])
twisted.trial.unittest.FailTest: not equal:
a = []
b = ['Foo\n']

===============================================================================
[ERROR]: twisted.internet.test.test_process.PTYProcessTestsBuilder_PollReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/base.py", line 409, in _continueFiring
    callable(*args, **kwargs)
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 213, in f
    result.append(f2.read())
exceptions.IOError: [Errno 4] Interrupted system call
===============================================================================
[ERROR]: twisted.internet.test.test_process.PTYProcessTestsBuilder_SelectReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/base.py", line 409, in _continueFiring
    callable(*args, **kwargs)
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 213, in f
    result.append(f2.read())
exceptions.IOError: [Errno 4] Interrupted system call
===============================================================================
[ERROR]: twisted.internet.test.test_process.ProcessTestsBuilder_PollReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/base.py", line 409, in _continueFiring
    callable(*args, **kwargs)
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 213, in f
    result.append(f2.read())
exceptions.IOError: [Errno 4] Interrupted system call
===============================================================================
[ERROR]: twisted.internet.test.test_process.ProcessTestsBuilder_SelectReactor.test_systemCallUninterruptedByChildExit

Traceback (most recent call last):
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/base.py", line 409, in _continueFiring
    callable(*args, **kwargs)
  File "/mnt/aquaria/nobackup/home/tim/tmp/Twisted-git/twisted/internet/test/test_process.py", line 213, in f
    result.append(f2.read())
exceptions.IOError: [Errno 4] Interrupted system call
-------------------------------------------------------------------------------

Ticket #733 comment 42 says "If neither of these is available, revert to the old behavior." It seems the revert-to-old-behaviour part of the patch isn't really working.

(as a side note, if there's a way to run Twisted from an SVN checkout with all the C extensions built, I'd be interested to hear it)

Attachments (1)

4331.patch (1.0 KB) - added by michaelnt 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 4 years ago by glyph

For the time being, you will want to do python setup.py build_ext --inplace.

Are you sure this is a regression? As I understand it, in principle, those errors were always possible.

comment:2 Changed 4 years ago by spiv

  • Cc spiv added

comment:3 Changed 4 years ago by TimAllen

  • Type changed from regression to defect

Looking more closely, it seems the failing tests in question didn't exist before #733 was merged, so I guess it's not technically a regression. Running the build_ext command you suggest makes the tests pass, as expected.

Still, it would be nice if the tests were SKIPPED or TODO rather than FAIL and ERROR in an environment where we know they won't work.

comment:4 Changed 4 years ago by glyph

  • Summary changed from SIGCHILD causes "Interrupted system call" errors on Python 2.4, in a fresh SVN checkout to SIGCHLD causes "Interrupted system call" errors on Python 2.4, in a fresh SVN checkout

comment:5 Changed 4 years ago by glyph

  • Keywords easy added
  • Owner changed from glyph to TimAllen

I think a first cut at fixing this would just be to skip these tests if Python is older than 2.6 and the native module isn't available for some reason. Care to take a whack at it?

comment:6 Changed 4 years ago by exarkun

  • Cc exarkun added

Skipping sounds good. Shouldn't be too tricky to implement. A Python version check is easy, of course. For the rest, just try the import I guess and skip if you get an ImportError.

comment:7 Changed 4 years ago by exarkun

#4466 was a duplicate of this.

comment:8 Changed 3 years ago by michaelnt

Is this issue to do with not building the c extensions on a fresh checkout or is it to do with Python 2.4. If it is to do with not building the extensions is it worth fixing?

If I try reproduce this error and run for instance t.i.t.test_process.PTYProcessTestsBuilder_Glib2Reactor the tests just hang.

It's not very clear from the previous comments what should be done to resolve this issue.

comment:9 Changed 3 years ago by Screwtape

  • Owner TimAllen deleted

I believe it is both - Python 2.6 has native support for this functionality; older Pythons don't. Pre-packaged Twisted has a C extension to support this functionality; SVN checkouts don't. Therefore people in the intersection of "people using Python 2.4" and "people using Twisted from SVN" (basically: people trying to get Twisted working smoothly on RHEL) have a problem.

Glyph suggested the fix "skip tests if the native functionality is missing and the C extension is missing", and no better suggestions have been made yet.

(for the record, TimAllen was my old username, and I am not currently working on this, so removing ownership)

Changed 3 years ago by michaelnt

comment:10 Changed 3 years ago by michaelnt

  • Keywords review added

I've attached a patch that skips the tests.

Would it be better to add an attribute to the _signals module to indicate more clearly if this feature is supported?

comment:11 Changed 3 years ago by <automation>

comment:12 Changed 3 years ago by jerub

  • Keywords review removed

I have not been able to replicate the hang on linux, python2.4, select reactor, without the patch, but I have verified that the patch does skip tests correctly when the c library is not available.

Thank-you, please merge.

comment:13 Changed 3 years ago by jerub

  • Resolution set to fixed
  • Status changed from new to closed

(In [30753]) SIGCHLD causes "Interrupted system call" errors on Python 2.4, in a fresh SVN checkout

Author: michaelnt
Reviewer: jerub
Fixes: #4331

When C-extensions are not complied for twisted, on python2.4, skip a test in
twisted.internet.test.test_process that may hang due to a SIGCHLD related
problem. Running 'python setup.py build_ext --inplace' will compile the
extension and cause the test to both run and pass.

Note: See TracTickets for help on using tickets.