From: Ben Darnell Date: Tue, 5 Jul 2011 02:15:37 +0000 (-0700) Subject: Check for forked status in autoreload X-Git-Tag: v2.1.0~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa9a1767e1321ef8ae451e6bf2d35a02cff40ca3;p=thirdparty%2Ftornado.git Check for forked status in autoreload --- diff --git a/tornado/autoreload.py b/tornado/autoreload.py index 5d16d77c6..b34ace885 100644 --- a/tornado/autoreload.py +++ b/tornado/autoreload.py @@ -35,6 +35,7 @@ import sys import types from tornado import ioloop +from tornado import process try: import signal @@ -80,6 +81,11 @@ def _reload_on_update(io_loop, modify_times): if _reload_attempted: # We already tried to reload and it didn't work, so don't try again. return + if process.task_id() is not None: + # We're in a child process created by fork_processes. If child + # processes restarted themselves, they'd all restart and then + # all call fork_processes again. + return for module in sys.modules.values(): # Some modules play games with sys.modules (e.g. email/__init__.py # in the standard library), and occasionally this can cause strange