Skip to content

Remove NT reconnect loop entirely#2398

Merged
mcm001 merged 3 commits intoPhotonVision:mainfrom
mcm001:remove-nt-reconnect
Mar 16, 2026
Merged

Remove NT reconnect loop entirely#2398
mcm001 merged 3 commits intoPhotonVision:mainfrom
mcm001:remove-nt-reconnect

Conversation

@mcm001
Copy link
Contributor

@mcm001 mcm001 commented Mar 15, 2026

Description

Back in #467 (comment) and https://discord.com/channels/725836368059826228/725846784131203222/974498049609056266 we added code to poke our NT client every 5 seconds to "clicking the save button in the settings window makes Photon show up again over networktables". Total hack, but it seemed to work. We didn't at the time dig any deeper in Wireshark or debug-level NT logs.

image

Now, it's 2026. 4 years on from the OG bug. And this code seems linked to these issues

Craig collected these log files as well:

craig-nt-never-connects.zip

The code path that handles TCP re-connection was also changed entirely since we first added this workaround. Regardless this hack was not removed as part of the NT3 to NT4 upgrade:

  • pre-NT4, reconnection was handled by TCPConnector::connect_parallel which delegates to TCPConnector. This uses raw socket APIs
  • post-NT4, reconnect is handled by ParallelTcpConnector. This uses libuv exclusively

@crschardt did some really great debugging with a rio and radio in the loop with a luma p1. In this test setup, removing this code improves stability markedly. I'd still like to get this more on robot time, as well as try to understand from Peter why we might have needed this code in the first place.

Changes

  • Remove periodic stop/restart of NetworkTables client every 5 seconds if NetworkTablesInstance::isConnected returns false.

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why, including events that led to this PR
  • If this PR changes behavior or adds a feature, user documentation is updated
  • If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly
  • If this PR touches configuration, this is backwards compatible with all settings going back to the previous seasons's last release (seasons end after champs ends)
  • If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated
  • If this PR addresses a bug, a regression test for it is added
  • If this PR adds a dependency, the license has been checked for compatibility and steps taken to follow it

@github-actions github-actions bot added the backend Things relating to photon-core and photon-server label Mar 15, 2026
@mcm001 mcm001 marked this pull request as ready for review March 15, 2026 05:08
@mcm001 mcm001 requested a review from a team as a code owner March 15, 2026 05:08
Copy link
Contributor

@crschardt crschardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply removes the reconnect loop. Based on my testing, this should eliminate the NT disconnect and failure to connect problems.

@mcm001 mcm001 merged commit 846528c into PhotonVision:main Mar 16, 2026
59 checks passed
@mcm001 mcm001 deleted the remove-nt-reconnect branch March 16, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Things relating to photon-core and photon-server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants