diff options
author | Robert Brewer <fumanchu@aminus.org> | 2006-11-18 19:27:15 +0000 |
---|---|---|
committer | Robert Brewer <fumanchu@aminus.org> | 2006-11-18 19:27:15 +0000 |
commit | f91f3bdac0961fa8b063df20dd5bbac5831f6c37 (patch) | |
tree | 68b2f0de684bc074e527bf2048a4c32855decae4 /cherrypy/_cpengine.py | |
parent | 123fbf5a42894a23093ed520ce5b05a4d2691cd4 (diff) | |
download | cherrypy-git-f91f3bdac0961fa8b063df20dd5bbac5831f6c37.tar.gz |
New Engine.reexec_retry (timeout in seconds) for os.execv call.
Diffstat (limited to 'cherrypy/_cpengine.py')
-rw-r--r-- | cherrypy/_cpengine.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cherrypy/_cpengine.py b/cherrypy/_cpengine.py index 9d8912e7..dd59feee 100644 --- a/cherrypy/_cpengine.py +++ b/cherrypy/_cpengine.py @@ -126,13 +126,19 @@ class Engine(object): # Some platforms (OS X) will error if all threads are not # ABSOLUTELY terminated. See http://www.cherrypy.org/ticket/581. - while True: + for trial in xrange(self.reexec_retry * 10): try: os.execv(sys.executable, args) - break + return except OSError, x: if x.errno != 45: raise + time.sleep(0.1) + else: + raise + + # Number of seconds to retry reexec if os.execv fails. + reexec_retry = 2 def autoreload(self): """Reload the process if registered files have been modified.""" |