From: Ross Burton Date: Tue, 31 Jan 2023 16:30:22 +0000 (+0000) Subject: httpserver: add error handler that write to the logger X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~1836 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4bcca3123685f410fc99e5cc23f2b8f39fd0a63;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git httpserver: add error handler that write to the logger Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oeqa/utils/httpserver.py b/meta/lib/oeqa/utils/httpserver.py index 2aa172bf799..80752c13770 100644 --- a/meta/lib/oeqa/utils/httpserver.py +++ b/meta/lib/oeqa/utils/httpserver.py @@ -44,6 +44,12 @@ class HTTPService: self.port = self.server.server_port self.process = multiprocessing.Process(target=self.server.server_start, args=[self.root_dir, self.logger]) + def handle_error(self, request, client_address): + import traceback + exception = traceback.format_exc() + self.logger.warn("Exception when handling %s: %s" % (request, exception)) + self.server.handle_error = handle_error + # The signal handler from testimage.bbclass can cause deadlocks here # if the HTTPServer is terminated before it can restore the standard #signal behaviour