Commit 7a88487
Wait for NetworkManager on first call to getAllInterfaces (#2240)
## Description
On the RubikPi3, PhotonVision starts before NetworkManager has fully
initialized. This causes it to fail to identify the network interfaces
available on the board, which leads to problems with configuring and
controling networking from the UI. The failure can be detected by the
call to `nmcli` returning an [exit status of
8](https://networkmanager.dev/docs/api/latest/nmcli.html#exit_status),
which means "NetworkManager is not running."
This PR retries the call to nmcli every 0.5 seconds until the exit
status does not equal 8, or a maximum of 10 attempts have been made. The
retry only occurs the first time `getAllInterfaces()` is called.
Subsequent calls to this method will only make one attempt to avoid
locking up the program if networking isn't responding as expected.
In my testing on the RubikPi3, the code has to retry for less than 2
seconds in order to get a valid response from NetworkManager.
The need for this is greatly reduced by
PhotonVision/photon-image-modifier#114, but this
code adds an additional layer of robustness against slow network
startup.
Closes #2212
## Meta
Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] 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 settings back to v2025.3.2
- [ ] 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
---------
Co-authored-by: samfreund <samf.236@proton.me>1 parent 0e33aef commit 7a88487
File tree
2 files changed
+39
-12
lines changed- photon-core/src/main/java/org/photonvision/common/networking
- photon-server/src/main/java/org/photonvision
2 files changed
+39
-12
lines changedLines changed: 35 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | | - | |
98 | | - | |
99 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
100 | 123 | | |
101 | 124 | | |
| 125 | + | |
| 126 | + | |
102 | 127 | | |
103 | 128 | | |
104 | 129 | | |
| |||
120 | 145 | | |
121 | 146 | | |
122 | 147 | | |
| 148 | + | |
| 149 | + | |
123 | 150 | | |
124 | 151 | | |
125 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | 279 | | |
284 | 280 | | |
285 | 281 | | |
| |||
293 | 289 | | |
294 | 290 | | |
295 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
0 commit comments