# HG changeset patch # User Jun Wu # Date 1457996883 0 # Node ID 5346e9b910fcccef4b1b294d6291a08fda8c3e15 # Parent 999e1acc61aa6d0f5d6f8418a5d0e52fc2e9849f chgserver: add an explicit gc to trigger __del__ SocketServer.ForkingMixIn uses os._exit which will skip all cleanup handlers. We want to run __del__ to make things like transactions, {ssh,http}peer, atomictempfile, dirstateguard, etc. work. This patch adds a "gc.collect()" to trigger __del__. It is helpful for chg to pass some test cases in test-devel-warnings.t. diff -r 999e1acc61aa -r 5346e9b910fc hgext/chgserver.py --- a/hgext/chgserver.py Tue Mar 15 10:36:02 2016 +0000 +++ b/hgext/chgserver.py Mon Mar 14 23:08:03 2016 +0000 @@ -42,6 +42,7 @@ import SocketServer import errno +import gc import inspect import os import re @@ -569,6 +570,9 @@ cerr = commandserver.channeledoutput(self.wfile, 'e') traceback.print_exc(file=cerr) raise + finally: + # trigger __del__ since ForkingMixIn uses os._exit + gc.collect() def _tempaddress(address): return '%s.%d.tmp' % (address, os.getpid())