diff --git a/src/ZEO/tests/multi.py b/src/ZEO/tests/multi.py index 326ed6a713d3bd35976a76bfd81e484ef80e4960..57c9620eccf596a35a2ece26a2d0e4b3ffa94e97 100644 --- a/src/ZEO/tests/multi.py +++ b/src/ZEO/tests/multi.py @@ -56,16 +56,18 @@ def start_server(addr): def start_client(addr, client_func=None): 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 diff --git a/src/ZEO/tests/stress.py b/src/ZEO/tests/stress.py index bb86cac25dea30579f307f2c850bb22bfb55bbaf..ec55d1685a2eb5c2862d2435c5554190a8b02f28 100644 --- a/src/ZEO/tests/stress.py +++ b/src/ZEO/tests/stress.py @@ -91,32 +91,34 @@ def start_child(zaddr): if pid != 0: return pid - storage = ClientStorage(zaddr, debug=1, min_disconnect_poll=0.5) - db = ZODB.DB(storage, pool_size=NUM_CONNECTIONS) - setup(db.open()) - conns = [] - conn_count = 0 - - for i in range(NUM_CONNECTIONS): - c = db.open() - c.__count = 0 - conns.append(c) - conn_count += 1 - - while conn_count < 25: - c = random.choice(conns) - if c.__count > NUM_TRANSACTIONS_PER_CONN: - conns.remove(c) - c.close() - conn_count += 1 + try: + storage = ClientStorage(zaddr, debug=1, min_disconnect_poll=0.5) + db = ZODB.DB(storage, pool_size=NUM_CONNECTIONS) + setup(db.open()) + conns = [] + conn_count = 0 + + for i in range(NUM_CONNECTIONS): c = db.open() c.__count = 0 conns.append(c) - else: - c.__count += 1 - work(c) + conn_count += 1 - os._exit(0) + while conn_count < 25: + c = random.choice(conns) + if c.__count > NUM_TRANSACTIONS_PER_CONN: + conns.remove(c) + c.close() + conn_count += 1 + c = db.open() + c.__count = 0 + conns.append(c) + else: + c.__count += 1 + work(c) + + finally: + os._exit(0) if __name__ == "__main__": main()