twisted / twisted/twisted

test_timelyProcessExited is fragile and may not catch actual problems

Open
#5,680 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug core new priority-normal
Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

itamarst's avatar @itamarst reported
Trac ID trac#5680
Type defect
Created 2012-05-15 12:27:04Z
Branch https://github.com/twisted/twisted/tree/process-test-5680

JP pointed out that test_timelyProcessExited in twisted.internet.test_process may fail without us noticing:

The problem is that the timeout support in runReactor is based on the IReactorTime implementation of the reactor it is running. It's quite likely that if the reactor is broken, instead of failing:

  1. the child will exit
  2. the reactor will not process the signal right away
  3. the timeout will elapse
  4. the reactor will wake up
  5. the signal will be processed, calling processEnded
  6. reactor.stop() will be called
  7. runReactor will notice the reactor was stopped and not raise a timeout exception
  8. the test will pass
Searchable metadata
trac-id__5680 5680
type__defect defect
reporter__itamar itamar
priority__normal normal
milestone__ 
branch__branches_process_test_5680 branches/process-test-5680
branch_author__itamar itamar
status__new new
resolution__None None
component__core core
keywords__ 
time__1337084824000000 1337084824000000
changetime__1338062326000000 1338062326000000
version__None None
owner__itamar itamar

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in twisted.internet.test_process at test_timelyProcessExited and read how runReactor handles IReactorTime timeouts. Reproduce or inspect the described child-exit and delayed-signal sequence, then make the test fail when the reactor does not process the signal promptly rather than accepting a late processEnded callback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.