[Zodb-checkins] CVS: ZEO/ZEO/tests - multi.py:1.4.4.2 stress.py:1.2.4.3

Jeremy Hylton jeremy@zope.com
Mon, 21 Jan 2002 16:20:28 -0500


Update of /cvs-repository/ZEO/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv12086

Modified Files:
      Tag: Standby-branch
	multi.py stress.py 
Log Message:
Make sure os.fork() doesn't run away with the machine.

Tracking similar changes on the trunk.


=== ZEO/ZEO/tests/multi.py 1.4.4.1 => 1.4.4.2 ===
     pid = os.fork()
     if pid == 0:
-        import ZEO.ClientStorage
-        if VERBOSE:
-            print "Client process started:", os.getpid()
-        cli = ZEO.ClientStorage.ClientStorage(addr, client=CLIENT_CACHE)
-        if client_func is None:
-            run(cli)
-        else:
-            client_func(cli)
-        cli.close()
-        os._exit(0)
+        try:
+            import ZEO.ClientStorage
+            if VERBOSE:
+                print "Client process started:", os.getpid()
+            cli = ZEO.ClientStorage.ClientStorage(addr, client=CLIENT_CACHE)
+            if client_func is None:
+                run(cli)
+            else:
+                client_func(cli)
+            cli.close()
+        finally:
+            os._exit(0)
     else:
         return pid
 


=== ZEO/ZEO/tests/stress.py 1.2.4.2 => 1.2.4.3 ===
     if pid != 0:
         return pid
-    
+    try:
+        _start_child(zaddr)
+    finally:
+        os._exit(0)
+
+def _start_child(zaddr):
     storage = ClientStorage(zaddr, debug=1, min_disconnect_poll=0.5,
                             wait_for_server_on_startup=1)
     db = ZODB.DB(storage, pool_size=NUM_CONNECTIONS)
@@ -116,8 +121,6 @@
         else:
             c.__count += 1
         work(c)
-
-    os._exit(0)
 
 if __name__ == "__main__":
     main()