Commit Graph
252 Commits
Author SHA1 Message Date
grossmj 6551bf56f8 Tweak and merge changes from 3.0 branch 2026-05-08 15:36:40 +08:00
arl1984 de0d050689 Fix telnet console silent-proxy hang on non-ConnectionError exit (#2344)
The run() cleanup block was guarded by `except (ConnectionError, OSError):`,
so exits via asyncio.CancelledError or any other exception type skipped
cleanup. Result: `_reader_process` stays pinned to the dead reader and
`_get_reader()` returns None for every subsequent client — the silent-proxy
symptom described in #2344.

Convert the except block to try/finally so cleanup always runs, regardless
of how `_process()` exits. Also:
- catch asyncio.CancelledError + generic Exception (with log.exception) so
  unexpected failures don't swallow the cleanup
- reset `_current_read = None` after cancellation
- use `dict.pop(..., None)` instead of `del` to avoid KeyError races if
  the broadcast loop's timeout handler already removed the entry

Triggering pattern observed in practice: a diagnostic tool opens a console,
sends a few commands, and closes abruptly (e.g. from a test harness or
orchestration script that cancels its Task). If the `_process()` task was
awaiting on one of the `network_read` / `reader_read` futures at the time
of cancellation, the CancelledError propagates up through `run()` and
bypasses the ConnectionError-only except clause. The proxy accepts future
connections (the listen socket is still alive) but never forwards any data
because `_reader_process` never got reset.

Validated against gns3/gns3-server:latest (2.2.56.1) running a 10-scenario
sequential regression batch that previously hung reliably on the 4th
sp_v1 / L3VPN scenario and now completes cleanly across all 10.
2026-04-16 14:46:49 +00:00
Jeremy Grossmann b222fba42c Revert "Backport telnetlib3 changes" 2026-04-05 21:58:21 +08:00
grossmj bc6374f7fc Add keepalive mechanism using the NOP command 2026-04-05 13:30:38 +08:00
Cristi c739a16d70 Improved exception handling and telnet client disconnect 2026-04-05 13:29:35 +08:00
Cristi 7684ce60ce Backport: Re-write current Telnet server implementation using telnetlib3 library 2026-04-05 13:29:25 +08:00
YueGuobin ffcfa4ccb1 feat(telnet_server): improve error handling and connection management
- Catch OSError alongside ConnectionError in connection processing to handle more network errors
- Move client_info retrieval inside try block to prevent AttributeError on failed connections
- Replace bare except with specific exceptions (OSError, ConnectionError, asyncio.TimeoutError)
- Improve error logging to include specific exception details and client information
2026-03-15 23:07:06 +08:00
Iskander Nafikov 2414b7a968 Fix telnet keepalive options on macOS 2026-01-26 00:31:03 +08:00
grossmj 4335fd7ce0 Drop Python 3.8 support 2026-01-24 18:51:44 +08:00
grossmj 942f021b58 Fix test_config.py 2025-11-17 11:26:06 +10:00
grossmj 19cabdfde6 Use log.debug for some messages in images.py 2024-11-28 12:42:50 +10:00
grossmj 3d58b437b4 Remove restrictions based on file extension when listing images and fix ELF header checks 2024-11-27 14:51:34 +10:00
grossmj a60e0d424d Overwrite user resources when the originals have changed.
Excepting configs and disks which can be customized.
2024-11-09 12:17:06 +10:00
grossmj 24bfc205db Symbolic links support for project export/import 2024-10-19 15:49:23 +10:00
grossmj 39057bd781 Fix check for IPv6 enabled on host 2024-06-17 16:41:40 +02:00
grossmj 3df7af12e1 Allow listing x86_64 IOU images. Fixes #2376 2024-05-09 15:21:05 +07:00
grossmj 18002a7580 Fix invalid escape sequences 2024-04-23 16:52:28 +07:00
John Fleming 763ef24108 Address the telnet console bug. Add wait_for for drain() call. If we're stuck on drain then the buffer isn't getting emptied. 5 seconds after drain() blocks, exception will be thrown and client will be removed from connection table and will no longer be a problem. 2024-02-02 22:09:31 -05:00
John Fleming 54abf85523 Update telnet_server.py
Maybe use the correct object name this time for the socket objects.
2024-01-25 01:41:57 -05:00
John Fleming ac86717bc0 Update telnet_server.py
Set tcp keepalive timers to 60 seconds. Seems to default to 2 hours on ubuntu 22. Most firewalls will age out an idle tcp session at 1 hour.

Will not address telnet console failing after a tcp session has failed (TimeoutError).
2024-01-23 13:15:17 -05:00
grossmj 7f595b089b Use certifi to get SSL root certificates 2023-08-06 20:37:10 +10:00
grossmj 5da742394e Use bundled cacert file on Windows and macOS 2023-08-05 22:21:08 +10:00
grossmj 7ef9b7600c Use DEFAULT_BUFFER_SIZE for md5sum 2023-08-03 12:09:24 +10:00
grossmj af83adfdf6 Add debug message when calculating MD5 checksum 2023-08-02 17:41:51 +10:00
grossmj af2fc8c111 Use proc.communicate() when checking for subprocess output
As recommended in https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process.stderr
2023-05-14 13:58:50 +08:00
grossmj 161f62d083 Install empty Qemu disks on first start 2023-05-05 22:40:58 +08:00
grossmj 30c85703c8 Attempt to fix "cannot reopen console". Ref #2182 2023-02-13 19:32:44 +08:00
grossmj a7d19fd89a Fix StreamWriter doesn't have the wait_closed() method in Python3.6. Fixes #2170 2023-01-20 13:14:57 +08:00
grossmj c57b0cbb53 Find Dynamips version before hypervisor launch and do not require Dynamips v0.2.23 2023-01-16 18:04:46 +08:00
grossmj ae200d9add Add Trusted Platform Module (TPM) support for Qemu VMs 2023-01-04 12:13:19 +08:00
grossmj b3a6b9173b Fix reset console. Fixes #1619 2022-12-31 09:43:17 +08:00
grossmj 1148dbc48e Fix issue when calling reset_console with running VPCS and Qemu nodes. Ref #1619 2022-12-30 20:54:37 +08:00
grossmj c56a8ef8f7 Only use importlib_resources for Python < 3.9. Fixes #2147 2022-12-30 09:15:40 +08:00
grossmj a4b24eaceb Use importlib_resources instead of pkg_resources and install built-in appliances in config dir. 2022-11-07 20:12:03 +08:00
grossmj f3b8f43689 Fix creating asyncio task in Python 3.6 2022-10-30 22:21:28 +08:00
grossmj 2d74d1ad94 Fix tests for Python 3.11 2022-10-30 22:07:44 +08:00
grossmj a55c9a5c6a Return disk usage for partition that contains the default project directory. Fixes #1947 2021-09-03 12:04:10 +09:30
grossmj 8aada49414 Some fixes for early support for Python3.10
The loop parameter has been removed from most of asyncio‘s high-level API following deprecation in Python 3.8.
2021-08-15 15:25:33 +09:30
grossmj 6847e19847 Change method to prevent forbidden directory traversal. Fixes #1894 2021-05-16 14:44:38 +09:30
grossmj 9a6978902d Fix tests. 2021-05-15 19:43:36 +09:30
grossmj 6294ad9e76 Prevent directory traversal 2021-05-15 17:35:32 +09:30
piotrpekala7 30cbfe2154 Update picture.py 2021-04-08 23:29:46 +02:00
grossmj 5d1fdceb98 Fix bug with application id allocation for IOU nodes. Fixes #3079 2020-10-27 19:41:24 +10:30
grossmj af22fb8e98 Comment unused code that causes issue with flake8 2020-06-26 18:47:31 +09:30
grossmj f498ab06b4 Wait longer for x11 socket file to be created. Ref #1761 2020-06-10 20:37:13 +09:30
grossmj 5b59a09e8d Deprecate running with Python 3.5 2020-05-19 16:14:58 +09:30
Bernhard Ehlers 10bb259248 Implement a minimum interval between cpu_percent() calls. Fixes #1738 2020-04-19 20:42:46 +02:00
Bernhard Ehlers 4ab100b716 Revert "Implement a minimum interval between psutil calls. Fixes #2262"
This reverts commit 3a09bd43dc.
2020-04-19 20:06:47 +02:00
grossmj c5412bf970 Allocate application IDs for IOU nodes on the controller.
An application ID is used by IOU to generate its interface Mac addresses. They must be unique across all opened projects sharing the same computes to avoid Mac address collisions.
2020-02-10 15:20:49 +08:00
grossmj a98fc2d308 Python3.8 support. Ref https://github.com/GNS3/gns3-gui/issues/2895 2019-11-11 12:44:31 +08:00