Opened 8 years ago

Closed 8 years ago

#4497 defect closed fixed (fixed)

test_cleanUpThreadPoolEvenBeforeReactorIsRun relies on reference counting

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords: tests, pypy
Cc: Branch: branches/threadpool-gc-4497
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

Description

twisted.internet.test.test_threads.ThreadTestsBuilder.test_cleanUpThreadPoolEvenBeforeReactorIsRun asserts that the reactor thread pool has been garbage collected immediately after running the code which should drop the reactor's reference to it.

On PyPy (and any runtime without reference counting) the thread pool will only have been collected after the garbage collector runs.

Change History (6)

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

Author: exarkun
Branch: branches/threadpool-gc-4497

(In [29256]) Branching to 'threadpool-gc-4497'

comment:2 Changed 8 years ago by Jean-Paul Calderone

(In [29257]) gc.collect() before checking that the weakref is dead

refs #4497

comment:3 Changed 8 years ago by Jean-Paul Calderone

Keywords: pypy review added
Owner: Jean-Paul Calderone deleted

comment:4 Changed 8 years ago by Ying Li

Keywords: review removed
Owner: set to Jean-Paul Calderone

Makes sense, simple change, tests pass. Kicked off a buildbot build too for lack of things to do in this review. :) http://buildbot.twistedmatrix.com/boxes-supported?branch=/branches/threadpool-gc-4497

Looks fine to merge.

comment:5 Changed 8 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [29298]) Merge threadpool-gc-4497

Author: exarkun Reviewer: cyli Fixes: #4497

Explicitly invoke the garbage collector in the reactor threadpool cleanup test so that the threadpool has a chance to be collected even on PyPy (or other runtimes without reference counting) before the check is made to see if it was collected.

comment:6 Changed 8 years ago by <automation>

Owner: Jean-Paul Calderone deleted
Note: See TracTickets for help on using tickets.