From aac6fbfc31e3f65bd4b1032a3d069d962dcd8075 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 10:42:53 +1000 Subject: [PATCH 1/9] Add freeze_support() for multiprocessing --- gns3server/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gns3server/main.py b/gns3server/main.py index 10ed2bf9..2c585663 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -32,6 +32,8 @@ import os import sys import types +from multiprocessing import freeze_support + # To avoid strange bug later we switch the event loop before any other operation if sys.platform.startswith("win"): import asyncio @@ -79,6 +81,8 @@ def main(): if not sys.platform.startswith("win"): if "--daemon" in sys.argv: daemonize() + else: + freeze_support() from gns3server.run import run run() From c437482e859b458cabfb5d3d39df2b5ad7109d88 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 11:08:47 +1000 Subject: [PATCH 2/9] Catch exceptions when computing image checksums. Ref https://github.com/GNS3/gns3-server/issues/2228 --- gns3server/web/web_server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index fd116b39..b64970e4 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -240,9 +240,12 @@ class WebServer: loop = asyncio.get_event_loop() with concurrent.futures.ProcessPoolExecutor(max_workers=1) as pool: - log.info("Computing image checksums...") - await loop.run_in_executor(pool, list_images, "qemu") - log.info("Finished computing image checksums") + try: + log.info("Computing image checksums...") + await loop.run_in_executor(pool, list_images, "qemu") + log.info("Finished computing image checksums") + except OSError as e: + log.warning("Could not compute image checksums: {}".format(e)) async def _on_startup(self, *args): """ From db315e3c3c96afe355d20a5b66c679b32887e9bc Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 11:17:48 +1000 Subject: [PATCH 3/9] Have freeze support for macOS as well --- gns3server/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gns3server/main.py b/gns3server/main.py index 2c585663..e004f52f 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -78,11 +78,13 @@ def main(): Entry point for GNS3 server """ + if hasattr(sys, "frozen"): + freeze_support() + if not sys.platform.startswith("win"): if "--daemon" in sys.argv: daemonize() - else: - freeze_support() + from gns3server.run import run run() From 7449064ea2cd1f5ccb33667b7278e98a15e3c3b9 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 12:21:39 +1000 Subject: [PATCH 4/9] Bump version to v2.2.45.dev2 --- gns3server/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/version.py b/gns3server/version.py index 2c8903ec..aed8dd2d 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,7 +23,7 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.2.45.dev1" +__version__ = "2.2.45.dev2" __version_info__ = (2, 2, 45, 99) if "dev" in __version__: From aa133c3b8a354ca498da4229a0c846de48d8ea1d Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 13:33:43 +1000 Subject: [PATCH 5/9] Add multiprocessing.set_start_method() --- gns3server/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gns3server/main.py b/gns3server/main.py index e004f52f..cc075f3a 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -31,8 +31,7 @@ import gns3server.utils.get_resource import os import sys import types - -from multiprocessing import freeze_support +import multiprocessing # To avoid strange bug later we switch the event loop before any other operation if sys.platform.startswith("win"): @@ -79,7 +78,8 @@ def main(): """ if hasattr(sys, "frozen"): - freeze_support() + multiprocessing.freeze_support() + multiprocessing.set_start_method("spawn") if not sys.platform.startswith("win"): if "--daemon" in sys.argv: From b81cc14cef2b011ba97f608f3f5335fc5f28c6ab Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 14:30:39 +1000 Subject: [PATCH 6/9] Do not compute checksums on macOS --- gns3server/main.py | 6 ++---- gns3server/web/web_server.py | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gns3server/main.py b/gns3server/main.py index cc075f3a..255bfc5a 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -77,13 +77,11 @@ def main(): Entry point for GNS3 server """ - if hasattr(sys, "frozen"): - multiprocessing.freeze_support() - multiprocessing.set_start_method("spawn") - if not sys.platform.startswith("win"): if "--daemon" in sys.argv: daemonize() + else: + multiprocessing.freeze_support() from gns3server.run import run run() diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index b64970e4..c10c576b 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -29,7 +29,6 @@ import functools import time import atexit import weakref -import concurrent.futures # Import encoding now, to avoid implicit import later. # Implicit import within threads may cause LookupError when standard library is in a ZIP @@ -238,7 +237,11 @@ class WebServer: Compute image checksums. """ + if sys.platform.startswith("darwin") and hasattr(sys, "frozen"): + # do not compute on macOS because errors + return loop = asyncio.get_event_loop() + import concurrent.futures with concurrent.futures.ProcessPoolExecutor(max_workers=1) as pool: try: log.info("Computing image checksums...") From c88f76b740b344c59ed610dbc325fe2c46abc321 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 14:59:28 +1000 Subject: [PATCH 7/9] Release v2.2.44.1 --- CHANGELOG | 5 +++++ gns3server/crash_report.py | 2 +- gns3server/version.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index debd74ce..4169cafd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ # Change Log +## 2.2.44.1 07/11/2023 + +* Catch exceptions when computing image checksums. Ref https://github.com/GNS3/gns3-server/issues/2228 +* Add freeze_support() for multiprocessing + ## 2.2.44 06/11/2023 * Bundle web-ui v2.2.44 diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index 866ad06a..f3ab0858 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -57,7 +57,7 @@ class CrashReport: Report crash to a third party service """ - DSN = "https://dcbac52ef824b8386b67cc8f07c4de70@o19455.ingest.sentry.io/38482" + DSN = "https://eb1150edfa1530053154ff1fcb67afd1@o19455.ingest.sentry.io/38482" _instance = None def __init__(self): diff --git a/gns3server/version.py b/gns3server/version.py index aed8dd2d..e390ee36 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,8 +23,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.2.45.dev2" -__version_info__ = (2, 2, 45, 99) +__version__ = "2.2.44.1" +__version_info__ = (2, 2, 44, -99) if "dev" in __version__: try: From 7afdcbb3d3b8be581423d9612d9da012b8a28c44 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 7 Nov 2023 19:11:57 +1000 Subject: [PATCH 8/9] Development in 2.2.45.dev3 --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index e390ee36..b37f4d28 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,8 +23,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.2.44.1" -__version_info__ = (2, 2, 44, -99) +__version__ = "2.2.45.dev3" +__version_info__ = (2, 2, 45, 99) if "dev" in __version__: try: From 6c5f75bf4329f7e66aa4994325709e6df46b0ef5 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 22 Nov 2023 10:32:50 +1000 Subject: [PATCH 9/9] Upgrade sentry-sdk and aiohttp --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9430e36d..df39d266 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,13 @@ jsonschema>=4.17.3,<4.18; python_version >= '3.7' # v4.17.3 is the last version to support Python 3.7 jsonschema==3.2.0; python_version < '3.7' # v3.2.0 is the last version to support Python 3.6 -aiohttp>=3.8.5,<3.9; python_version < '3.12' -aiohttp==3.9.0b0; python_version == '3.12' +aiohttp>=3.8.5,<3.9; python_version <= '3.7' +aiohttp>=3.9.0,<3.10; python_version > '3.7' aiohttp-cors>=0.7.0,<0.8 aiofiles>=23.2.1,<23.3; python_version >= '3.7' aiofiles==0.8.0; python_version < '3.7' # v0.8.0 is the last version to support Python 3.6 Jinja2>=3.1.2,<3.2; python_version >= '3.7' Jinja2==3.0.3; python_version < '3.7' # v3.0.3 is the last version to support Python 3.6 -sentry-sdk==1.34.0,<1.35 +sentry-sdk==1.36.0,<1.37 psutil==5.9.6 async-timeout>=4.0.2,<4.1 distro>=1.8.0