Commit 60cc6b0f authored by Jason Madden's avatar Jason Madden

Looks like a memory-fence type issue on PyPy on Win.

Try killing the pool to see if that buys us what we need.
parent 5a05e824
......@@ -786,9 +786,11 @@ class TestWorkerProfileAndTrace(TestCase):
self.ClassUnderTest = Pool
pool = self._makeOne(1)
pool = self._makeOne(1, create_all_worker_threads=True)
assert isinstance(pool, Pool)
# Do this after creating the pool and its thread to verify we don't
# capture the function at thread creation time.
setter(callback)
......@@ -796,6 +798,16 @@ class TestWorkerProfileAndTrace(TestCase):
self.assertEqual(res, 1701)
self.assertGreaterEqual(called[0], 1)
# Shutdown the pool. PyPy2.7-7.3.1 on Windows/Appveyor was
# properly seeing the before_task value, but after_task was empty.
# That suggested a memory consistency type issue, where the updates
# written by the other thread weren't fully visible to this thread
# yet. Try to kill it to see if that helps. (Couldn't reproduce
# on macOS).
#
# https://ci.appveyor.com/project/jamadden/gevent/build/job/wo9likk85cduui7n#L867
pool.kill()
# The function is active only for the scope of the function
self.assertEqual(before_task, [task, None, callback])
self.assertEqual(after_task, [task, callback, None])
......
......@@ -460,7 +460,7 @@ class ThreadPool(GroupMappingMixin):
self.fork_watcher.stop()
def _adjust_wait(self):
delay = 0.0001
delay = self.hub.loop.approx_timer_resolution
while True:
self._adjust_step()
if len(self._worker_greenlets) <= self._maxsize:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment