fix(perf): the performance sender reconnects when Windows aborts a kept connection #1299
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1299
Loading…
Reference in a new issue
No description provided.
Delete branch "dukenheimer/Longshot:fix/perf-report-aborted"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Windows 11 (the sender and its check); Linux (WSL Ubuntu 24.04), the check · Needs: none
Why
With the performance statistics on, the launcher sends the game's waiting summaries at its start, all over one kept
connection. If the relay lets that connection go between two summaries, the sender should reconnect and go on. On
Linux it does. On Windows it stops: Windows reports the dropped connection as
ConnectionAbortedError(WinError10053), which the sender didn't count as a dropped connection. It sends one summary, and the rest wait until the
launcher's next start (and past 48, the oldest are dropped).
tests/test_perf_report.pyhas failed on Windows since#983 brought the sender ("{'sent': 1, 'refused': 0, 'left': 2}"), and it passes on Linux.
#1265 is about the same sender for other causes (404 and redirects deleting summaries, overlapping senders, the
sending rate). This PR doesn't touch those parts (
answer(), the lock,LONGSHOT_PERF_MAX_SENDS).Prior work: none found (searched
ConnectionAbortedError,10053,perf_report, "performance report sender"; #1277lists
test_perf_report.pyamong Windows' failures on main but doesn't change the sender).How to reproduce
Seen on: Windows 11, Python 3.14 (any GPU: the launcher's sender, not the game)
Settings and switches: the performance statistics' tick on (
send=1inlongshot_perf.ini), more than one summary waitingSteps: On main, on Windows, run
python -I -B tests/test_perf_report.py --cxx <clang++>, or send to a local relay that closes the kept connection after its first answer:LONGSHOT_PERF_URL=http://127.0.0.1:<port>/perf python -I nx2/perf_report.py <game folder> --sendExpected: every summary sent: the second on a new connection, none twice
Actual:
{'sent': 1, 'refused': 0, 'left': 2}: the reused connection'srequestraisesConnectionAbortedError(10053), which falls through to "later"What changed
The sender now treats
ConnectionAbortedErrorlike the other errors of a dropped kept connection. It sends thatsummary once more on a new connection and goes on, on Windows as on Linux.
Relay.post()innx2/perf_report.py:ConnectionAbortedErrorjoinsRemoteDisconnected,BrokenPipeErrorandConnectionResetError. The retry is unchanged: once, only on a reused connection.tests/test_perf_report.py(first commit) gets a case where the connection raisesConnectionAbortedError(10053)at a kept connection's next request. That is Windows' behavior, simulated, so the case fails on main on any OS. It expects 3 sent, in order, none twice, over 3 connections.Measurements
Verdict: fixed. The new case fails on main on Windows and Linux and passes here. The existing "dropped" case fails 3 of 3 on Windows on main and passes 3 of 3 here. The real sender sends all 3 where main sent 1.
Hardware: Windows 11, Python 3.14, clang 23.1.5 (llvm-mingw, the Builder's) for the check's C++ part; WSL Ubuntu 24.04, Python 3.12, g++ 13.3
Scene: none: the launcher's sender and game-free checks
Method:
python -I -B tests/test_perf_report.py --cxx <compiler>, 3 runs on Windows and 1 on Linux per commit; the realnx2/perf_report.py <folder> --sendonce per commit against a local relay (the test's stand-in) that drops the kept connection after its first answer, 3 summaries waiting. The PR was rebased onto main @f88e6e3a(#1291 and #1288, which touch neither the sender nor its check); the check was run again there on both commits, with the same result. The other runs were on the earlier main,8e9cfc3a.How to reproduce: the commands above, on the first commit (main plus the test) and on this PR
f88e6e3ae815a028perf_report.py --send, Windows, relay drops the connectionFlags and settings
None
Testing
Tested:
tests/test_perf_report.py(with its C++ part, clang 23), 3 runs on each commit (table above).tests/test_perf_report.pyonce on each commit.python -I nx2/perf_report.py <folder> --sendwithLONGSHOT_PERF_URLset to a local relay that drops the kept connection, the way the launcher starts it. Main sent 1 and left 2 waiting; this PR sent 3, none twice.python -I -B tests/run_all.py --changedafter the rebase: 2 passed (test_perf_report.py,byte_compile_tracked.py).python -I -B tests/run_all.py(Windows 11, clang 23, 12 jobs): 616 passed, 45 failed, 52 skipped. None fails because of this PR.test_hardware_reportandtest_bug_reportfailed only because Tooling isn't beside this worktree; they pass withMAGICBEAN_TOOLINGset. With it set, the failing checks rerun on main @8e9cfc3a(this PR's base before the rebase), a clean checkout: main fails 44. This PR fails 43: the same, lesstest_perf_report.py. That leavestest_menu_i18n.py(main's menu counts, fixed separately on dukenheimer:fix/menu-pt-br-count) and these 42, which fail on main alike on this PC:test_auto_handheld.py,test_bug_report_defaults.py,test_cpu_report.py,test_crash_dialog.py,test_crt_options.py,test_damage_debug_menu.py,test_discover.py,test_display_startup_failure.py,test_dlss_feature_size.py,test_failed_compile_keeps_objects.py,test_framegen_preset.py,test_fsr_uniform_ownership.py,test_guest_imported.py,test_hud_layout_row.py,test_import_reach.py,test_invalidate_vcore.py,test_job_queue.py,test_lift_lookups.py,test_linux_preflight.py,test_linux_pressure.py,test_mirror_budget.py,test_missing_nup.py,test_pads_after_menu.py,test_parallel_init_order.py,test_pending_guest_import.py,test_pipeline_play_cache.py,test_present_thread.py,test_profiling_mode.py,test_readback_timeout_source.py,test_replay_write_order.py,test_rumble_menu.py,test_run_all_changed.py,test_slow_frames.py,test_staging_burst.py,test_target_image_pool.py,test_tested_configurations.py,test_upscaler_round_trip.py,test_upscaler_rows.py,test_vcore_escape.py,test_vk_occlusion_queries.py,test_walk_key.py,test_walk.py.Not tested: The live relay (
data-services.magicbean.dev): when it drops a kept connection depends on its keep-alive timeout, which is why the check uses a local relay. The launcher itself wasn't started; it runs this same--sendcommand.Must be tested:
Risks
What could break: If a connection were aborted after the relay had taken a summary but before its answer arrived, that summary could be sent twice.
ConnectionResetErroralready has this risk, and the retry happens once, only on a reused connection.Turning it off: revert the commit
Compatibility: Nothing changes: no file format, switch or address changes. Summaries already waiting are sent at the next launcher start as before.
Issues
See #1265
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.On Windows a kept connection the relay let go raises ConnectionAbortedError (WinError 10053) at the next request, not RemoteDisconnected, and Relay.post() in nx2/perf_report.py doesn't take it as a dropped connection: the summary waits, and so do the rest, until the launcher's next start. The existing "dropped" case shows it on Windows only; this one raises the same error from the connection on any OS. Fails on main on Windows and Linux: {'sent': 1, 'refused': 0, 'left': 2}. Assisted-by: GitHub Copilot (Claude Opus 5.5) Co-authored-by: Copilot App <[email protected]>Tested in game: not run by the game: the launcher's sender, run as python -I nx2/perf_report.py --send against a local relay that drops kept connections, Windows 11: 3 sent, none twice (main: 1 sent, 2 left)
With performance statistics on, Windows drops the sender's kept connection as
ConnectionAbortedError(WinError 10053). The sender treated that as "try later" and left the rest of the summaries until the next launch. I read heade815a028. Approved.Relay.postalready retried once, and only when the connection had been reused, forRemoteDisconnected,BrokenPipeErrorandConnectionResetError.ConnectionAbortedErrornow takes that same path. A failure on a new connection still waits. A summary the relay accepted and then aborted before the answer could be sent twice, whichConnectionResetErroralready risked, and the retry still happens only once.The new case uses the real sender. A kept connection raises
ConnectionAbortedErroron its next request, and three summaries go out in order on three connections. It fails on main on Linux as well as Windows. The live relay was not used. The launcher was not started. It runs this same send.This does not cover the other sender faults in #1265.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.