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: 2022-10.3-langdale~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3656cf1f749fea837ac2e263f505fcb18965839;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git httpserver: add error handler that write to the logger Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (cherry picked from commit a4bcca3123685f410fc99e5cc23f2b8f39fd0a63) Signed-off-by: Steve Sakoman --- diff --git a/meta/lib/oeqa/utils/httpserver.py b/meta/lib/oeqa/utils/httpserver.py index 8ce1dd42f49..5860b0a3833 100644 --- a/meta/lib/oeqa/utils/httpserver.py +++ b/meta/lib/oeqa/utils/httpserver.py @@ -40,6 +40,12 @@ class HTTPService(object): 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