Skip to content

Properly handle non-managed networking#2448

Open
mcm001 wants to merge 2 commits intoPhotonVision:mainfrom
mcm001:handle-non-managed-local-mac
Open

Properly handle non-managed networking#2448
mcm001 wants to merge 2 commits intoPhotonVision:mainfrom
mcm001:handle-non-managed-local-mac

Conversation

@mcm001
Copy link
Copy Markdown
Contributor

@mcm001 mcm001 commented Apr 27, 2026

Description

The previous code did not handle various null cases, but more importantly, the non-managed device codepath was totally bjork if the server was not at localhost. This code path is only taken if networking is disabled, and I wasnt able to find any testing outside of localhost:

[19:34:04] [2026-04-24 19:34:05] [General - NetworkUtils] [ERROR] java.lang.NullPointerException: Cannot invoke "java.net.NetworkInterface.getHardwareAddress()" because the return value of "java.net.NetworkInterface.getByInetAddress(java.net.InetAddress)" is null
    at org.photonvision.common.networking.NetworkUtils.getMacAddress(NetworkUtils.java:270)
    at org.photonvision.common.dataflow.networktables.NetworkTablesManager.checkHostnameAndCameraNames(NetworkTablesManager.java:249)
    at org.photonvision.common.util.TimedTaskManager$CaughtScheduledThreadPoolExecutor.lambda$wrap$0(TimedTaskManager.java:56)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
    at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:369)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:310)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
    at java.base/java.lang.Thread.run(Thread.java:1474)

Changes

  • Open/connect a UDP socket to query local address
  • Handle more error cases, weird network interfaces more cleanly

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

@mcm001 mcm001 requested a review from a team as a code owner April 27, 2026 02:45
@github-actions github-actions Bot added the backend Things relating to photon-core and photon-server label Apr 27, 2026
@mcm001
Copy link
Copy Markdown
Contributor Author

mcm001 commented Apr 27, 2026

Another option is wpilibsuite/allwpilib#8828

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.

1 participant