Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pi startup fix #923

Merged
merged 5 commits into from
Sep 28, 2023
Merged

Pi startup fix #923

merged 5 commits into from
Sep 28, 2023

Conversation

amquake
Copy link
Member

@amquake amquake commented Sep 26, 2023

Fixes #917

I just made a quick hacky fix that caches the interface read ("nmcli -t -f GENERAL.CONNECTION,GENERAL.DEVICE,GENERAL.TYPE device show") to once every 5 seconds since it gets called a lot. Not sure if this could cause problems (does this shell command return new values depending on e.g. new ethernet connections? or does that fall under getAllActiveInterfaces() filtering?). Still don't like how this can cause this error in the first place, but I'm not sure how to get more info about that.

@amquake amquake requested a review from a team as a code owner September 26, 2023 22:40
@amquake amquake mentioned this pull request Sep 26, 2023
@mcm001
Copy link
Contributor

mcm001 commented Sep 26, 2023

In what way exactly does this fix it? (just like document it)

@mcm001
Copy link
Contributor

mcm001 commented Sep 26, 2023

Does this caching change actually fix the startup loop?

@amquake
Copy link
Member Author

amquake commented Sep 26, 2023

Does this caching change actually fix the startup loop?

Yes, at least on my pi. As mentioned in the issue, I'm guessing the network manager shell commands are blocking the camera use in libcamera somehow which causes it to crash. This just caches the shell command for listing network interfaces so it doesn't happen several times rapidly while booting up.

@mdurrani808 mdurrani808 added this to the 2024 Beta milestone Sep 26, 2023
@mcm001
Copy link
Contributor

mcm001 commented Sep 27, 2023

I wonder what would happen if the pi boots before the radio. Does the Ethernet connection actually show up and get managed?

@amquake
Copy link
Member Author

amquake commented Sep 28, 2023

I wonder what would happen if the pi boots before the radio. Does the Ethernet connection actually show up and get managed?

From what I've understood, the NetworkTablesManager will keep trying to restart the NT client until it connects, which is separate from NetworkManager managing hostname and dhcp/static. The NetworkManager will only initialize these on bootup and when general settings are saved. The network interfaces will additionally be updated when a new websocket connects, new camera connects, or settings are broadcasted/loaded.

I'm assuming the configuration done in the NetworkManager initialize is redundant when deserializing a previously setup NetworkConfig, so not having the interface on bootup wouldn't be a problem. It would only be a problem if the NetworkConfig wasn't previously initialized, since NetworkManager won't reinitialize when it finds an active interface and you might not be able to connect without that initialization.

Does that sound right?

@mcm001
Copy link
Contributor

mcm001 commented Sep 28, 2023

NetworkManager

Yep, from a quick glance through the code, the link state at boot once configured shouldn't matter. LGTM, send it and see if it breaks

@mcm001 mcm001 merged commit 3c85291 into PhotonVision:master Sep 28, 2023
20 checks passed
@mcm001 mcm001 deleted the pi-startup-fix branch September 28, 2023 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pi4 startup loop
3 participants