From fa9a1767e1321ef8ae451e6bf2d35a02cff40ca3 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Mon, 4 Jul 2011 19:15:37 -0700 Subject: [PATCH] Check for forked status in autoreload --- tornado/autoreload.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.47.2