From: Johannes Berg <johannes.berg@xxxxxxxxx> Unfortunately, some objects (WlantestCapture, WpaSupplicant and wpaspy.Ctrl) use __del__ and actually have some logic there. This is more or less wrong, and we should be using context managers for it. However, cleaning that up is a pretty large task. Unfortunately, __del__ can cause reentrant logging which is wrong too, because it might be invoked while in the middle of a logging call, and the __del__ of these objects closes connections and logs while doing that. Since we're (likely) using cpython, we can work around this by explicitly calling gc.collect() in a context where the logging and close is fine, not only ensuring that all the connections are closed properly before the next test, but also fixing the issue with reentrant logging. Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- tests/hwsim/run-tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 019533f54423..0784575f283d 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -8,6 +8,7 @@ import os import re +import gc import sys import time from datetime import datetime @@ -576,6 +577,15 @@ def main(): if args.loglevel == logging.WARNING: print("Exception: " + str(e)) result = "FAIL" + + # Work around some objects having __del__, we really should + # use context managers, but that's complex. Doing this here + # will (on cpython at least) at make sure those objects that + # are no longer reachable will be collected now, invoking + # __del__() on them. This then ensures that __del__() isn't + # invoked at a bad time, e.g. causing recursion in locking. + gc.collect() + open('/dev/kmsg', 'w').write('TEST-STOP %s @%.6f\n' % (name, time.time())) for d in dev: try: -- 2.36.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap