-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Refactor s6 scripts to the new format #5135
Refactor s6 scripts to the new format #5135
Conversation
✅ Deploy Preview for frigate-docs canceled.
|
I was never able to build the Frigate image anymore since the tensorrt was added. I need to investigate why, so I can also test this PR. |
Wow. I actually needed binfmt installed. Then I was able to build the Frigate container. That's weird... anyway, here's how to install it: docker run --privileged --rm tonistiigi/binfmt --install all No, sorry, never mind. I was actually calling the wrong make target. |
Ok, I think this is working. This also fixes an issue that always existed, that was causing the container to exit abruptly instead of waiting for Frigate to gracefully finish. |
Alright, I did some more testing. Logging and everything else seems to be working normally. This however does not take down the container if go2rtc exits with 0. I'm working on it now. |
Done. Some demos: BeforeCode_j9UCdR0XCy.mp4AfterCode_AQQPoM4DSr.mp4 |
Actually this is now handling the case when Frigate exits with exit code 0 and makes the container exits with exit code 1. Question: which exit code is Frigate exiting with when restarting from the UI? |
Line 630 in 19afb03
|
Ok, from me this is now ready to be reviewed. |
… migrate-s6-scripts
Co-authored-by: Felipe Santos <[email protected]>
@felipecrs restart from container doesn't seem to be working for me. It stops frigate but the container keeps running |
That's weird. I tested it. Did you restart from Frigate UI? I'll test again. |
I used the save config & restart option. Frigate would not come up and I checked the logs and go2rtc was still running |
Code_bpoVRhY7BB.mp4 |
Is there any chance you forgot to rebuild the container? |
Oh... I think this might be possible in the devcontainer. I'll push a fix. |
No, I did a full fresh build. It was also working before the changes.
I am not using devcontainer for these changes I am using a full E2E docker running on my main server |
It looks like it gets to |
Yes. It takes a while indeed. That's why I also changed the text from UI. BTW, go2rtc only stops AFTER frigate now, not before. That's why go2rtc was still running in your container. And, I think we should fix this from Python side, not from s6 side, because it's Python who manages the detection process. |
The only reason why this was working before was because s6 was mistakenly not waiting for Frigate to exit. |
I do agree but at the same time there is always a case where the process might get stuck and I think S6 should force stop the container at some point also I let the container go for 5 minutes and it never restarted |
That's valid. I can add a timeout, this is a supported feature from s6. Will do it later. But if we could improve in Python side, it would also probably speed-up the whole process. |
Fixes
This fixes a long standing issue that was causing s6 to abruptly kill the Frigate process during exit process. Now it properly waits as long as needed for Frigate to exit gracefully, which should help to prevent database corruptions.
Prevent go2rtc from restarting without restarting the whole container. This can't happen, otherwise the birdseye restream feed will be lost, as it's added only during Frigate startup.
Never tolerate go2rtc to exit, even with status code 0. If it exits, the container will also exit (docker takes care of restarting after the container exits). The only situation in which this is tolerated is when Frigate also exited with status code 0 (probably because someone requested a restart from the UI).
Also, similarly never tolerates Frigate to exit. If Frigate exits, the container is also now exited (docker takes care of restarting after the container exits).
References