From e91116fe1bb36a8425f72a6de9f1acc6d5740738 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Mon, 7 Jun 2021 15:23:16 -0500 Subject: [PATCH] Close browser after every selenium use --- judge/pdf_problems.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/judge/pdf_problems.py b/judge/pdf_problems.py index 00fdba4..a5b318f 100644 --- a/judge/pdf_problems.py +++ b/judge/pdf_problems.py @@ -300,16 +300,19 @@ class SeleniumPDFRender(BasePdfMaker): except TimeoutException: logger.error('PDF math rendering timed out') self.log = self.get_log(browser) + '\nPDF math rendering timed out' + browser.quit() return response = browser.execute_cdp_cmd('Page.printToPDF', self.template) self.log = self.get_log(browser) if not response: + browser.quit() return with open(self.pdffile, 'wb') as f: f.write(base64.b64decode(response['data'])) self.success = True + browser.quit() if HAS_PUPPETEER: