Mercurial > hg-stable
changeset 28553:5346e9b910fc
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.
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 14 Mar 2016 23:08:03 +0000 |
parents | 999e1acc61aa |
children | fa3438548b3d |
files | hgext/chgserver.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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())