Closed RutgerDiehard closed 7 months ago
Back in the early days of Frigate, an underpowered Coral would lock up or crash my entire system. It wasn't until I used a powered USB hub that all of my problems went away.
The only time I've had a similar issue is in Frigate development - specifically when I'm working on some code and it crashes. Sometimes I have to completely unplug my USB Coral and plug it back in. It then takes a little time for the internal driver to load (lsusb
shows "Global Unichip Corp" instead of "Google Inc"). I have never seen it in on my production setup, though I've recently moved away from a USB-based Coral to an internal PCI-based one.
So if your "sticking" Coral has disappeared with a powered USB hub, I bet the re-initialization delay probably has to do with the chipset in the USB hub you're using or one of the USB cables. I would first try swapping hubs and/or cables.
Thanks @hawkeye217 I suspected the USB hub (TP Link) may be the cause. I had tried a new USB cable to the Coral initially which, in the original PC, didn't really make any difference so I went back to the Coral-supplied cable plugged in to the hub. I've just removed the hub and plugged the Coral directly into the PC with the new USB cable to see if that makes a difference. To confirm though, it restarts every time, first time when not plugged in to the hub.
I've also noticed this issue. Frigate fails to detect the first go-around, crashes, and then detects the USB Coral after restarting. It's an issue with Frigate and Google Coral USB.
Woke up this morning to this :-(
2024-02-05 17:35:47.504233344 [INFO] Preparing Frigate...
2024-02-05 17:35:47.522570262 [INFO] Starting Frigate...
2024-02-05 17:35:48.481902422 [2024-02-05 17:35:48] frigate.app INFO : Starting Frigate (0.13.1-34fb1c2)
2024-02-05 17:35:48.525608702 [2024-02-05 17:35:48] peewee_migrate.logs INFO : Starting migrations
2024-02-05 17:35:48.529037877 [2024-02-05 17:35:48] peewee_migrate.logs INFO : There is nothing to migrate
2024-02-05 17:35:48.532026551 [2024-02-05 17:35:48] frigate.app INFO : Recording process started: 368
2024-02-05 17:35:48.534044108 [2024-02-05 17:35:48] frigate.app INFO : go2rtc process pid: 89
2024-02-05 17:35:48.547961389 [2024-02-05 17:35:48] detector.coral INFO : Starting detection process: 378
2024-02-05 17:35:51.191840635 [2024-02-05 17:35:48] frigate.app INFO : Output process started: 380
2024-02-05 17:35:51.197223890 [2024-02-05 17:35:48] frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as usb
2024-02-05 17:35:51.197766842 [2024-02-05 17:35:48] frigate.app INFO : Camera processor started for Front_Door: 387
2024-02-05 17:35:51.197861023 [2024-02-05 17:35:48] frigate.app INFO : Camera processor started for Drive: 388
2024-02-05 17:35:51.197945376 [2024-02-05 17:35:51] frigate.detectors.plugins.edgetpu_tfl INFO : TPU found
2024-02-05 17:35:51.197991389 [2024-02-05 17:35:48] frigate.app INFO : Capture process started for Front_Door: 391
2024-02-05 17:35:51.198059465 [2024-02-05 17:35:48] frigate.app INFO : Capture process started for Drive: 394
2024-02-06 02:58:20.075355223 [2024-02-06 02:58:20] frigate.watchdog INFO : Detection appears to be stuck. Restarting detection process...
2024-02-06 02:58:20.075650189 [2024-02-06 02:58:20] root INFO : Waiting for detection process to exit gracefully...
2024-02-06 02:58:50.104470446 [2024-02-06 02:58:50] root INFO : Detection process didnt exit. Force killing...
2024-02-06 02:58:50.116969921 [2024-02-06 02:58:50] root INFO : Detection process has exited...
2024-02-06 02:58:50.141654868 [2024-02-06 02:58:50] detector.coral INFO : Starting detection process: 73324
2024-02-06 02:58:52.791030746 [2024-02-06 02:58:50] frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as usb
2024-02-06 02:58:52.804029925 [2024-02-06 02:58:52] frigate.detectors.plugins.edgetpu_tfl INFO : TPU found
It lasted over nine hours before crashing. I've ordered a Sabrent powered USB hub which should be here today (good ol' Amazon). I hope this will solve the issue.
A real USB 3.0 port should be able to supply 2A of power. If your prts are not up to spec, a powered USB 3.0 hub is the solution.
Woke up this morning to this :-(
2024-02-05 17:35:47.504233344 [INFO] Preparing Frigate... 2024-02-05 17:35:47.522570262 [INFO] Starting Frigate... 2024-02-05 17:35:48.481902422 [2024-02-05 17:35:48] frigate.app INFO : Starting Frigate (0.13.1-34fb1c2) 2024-02-05 17:35:48.525608702 [2024-02-05 17:35:48] peewee_migrate.logs INFO : Starting migrations 2024-02-05 17:35:48.529037877 [2024-02-05 17:35:48] peewee_migrate.logs INFO : There is nothing to migrate 2024-02-05 17:35:48.532026551 [2024-02-05 17:35:48] frigate.app INFO : Recording process started: 368 2024-02-05 17:35:48.534044108 [2024-02-05 17:35:48] frigate.app INFO : go2rtc process pid: 89 2024-02-05 17:35:48.547961389 [2024-02-05 17:35:48] detector.coral INFO : Starting detection process: 378 2024-02-05 17:35:51.191840635 [2024-02-05 17:35:48] frigate.app INFO : Output process started: 380 2024-02-05 17:35:51.197223890 [2024-02-05 17:35:48] frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as usb 2024-02-05 17:35:51.197766842 [2024-02-05 17:35:48] frigate.app INFO : Camera processor started for Front_Door: 387 2024-02-05 17:35:51.197861023 [2024-02-05 17:35:48] frigate.app INFO : Camera processor started for Drive: 388 2024-02-05 17:35:51.197945376 [2024-02-05 17:35:51] frigate.detectors.plugins.edgetpu_tfl INFO : TPU found 2024-02-05 17:35:51.197991389 [2024-02-05 17:35:48] frigate.app INFO : Capture process started for Front_Door: 391 2024-02-05 17:35:51.198059465 [2024-02-05 17:35:48] frigate.app INFO : Capture process started for Drive: 394 2024-02-06 02:58:20.075355223 [2024-02-06 02:58:20] frigate.watchdog INFO : Detection appears to be stuck. Restarting detection process... 2024-02-06 02:58:20.075650189 [2024-02-06 02:58:20] root INFO : Waiting for detection process to exit gracefully... 2024-02-06 02:58:50.104470446 [2024-02-06 02:58:50] root INFO : Detection process didnt exit. Force killing... 2024-02-06 02:58:50.116969921 [2024-02-06 02:58:50] root INFO : Detection process has exited... 2024-02-06 02:58:50.141654868 [2024-02-06 02:58:50] detector.coral INFO : Starting detection process: 73324 2024-02-06 02:58:52.791030746 [2024-02-06 02:58:50] frigate.detectors.plugins.edgetpu_tfl INFO : Attempting to load TPU as usb 2024-02-06 02:58:52.804029925 [2024-02-06 02:58:52] frigate.detectors.plugins.edgetpu_tfl INFO : TPU found
It lasted over nine hours before crashing. I've ordered a Sabrent powered USB hub which should be here today (good ol' Amazon). I hope this will solve the issue.
To be clear, the detection process being "stuck" is something different than what I was referring to, which was to the Failed to load delegate from libedgetpu.so.1.0
error on frigate startup. If everything is passed through to Docker correctly, seeing this initial error can sometimes be because the Coral's internal driver is not yet loaded. Then when frigate auto-restarts, the driver is loaded and everything functions normally.
With that said, I think you probably still have a power-related issue that is hanging the Coral.
Frigate can't do anything to improve or fix this. If you continue to have problems, I'd suggest moving toward an internal PCIe or M.2 Coral.
New Sabrent powered USB 3 hub installed with new cable to Coral.
I tested a simple Frigate restart from within Home Assistant after Frigate started successfully using the new hub. It took over 11 minutes of constant watchdog restarts for Frigate to finally detect the Coral and start successfully. It must have restarted 20 times with the message Failed to load delegate from libedgetpu.so.1.0
Is this normal for the Coral driver to take this long to load? It kind of makes tweaking settings impractical without plugging directly into the PC USB port.
That's not something I have experienced. And if it was a bug in Frigate, we'd see many more reports of the issue.
So it must be something specific to your hardware and setup. Beyond buying a new Coral, I'm not sure what else it could be.
New Sabrent powered USB 3 hub installed with new cable to Coral.
What power-supply ? 3-5A minimum is recommended.
I know it says 4 TOPS aka 2 TOPS/W. And with 5V that is less than 0.5A. But people have Issues with power - so I would make sure it has full 3A USB available.
Power Supply states 12V 3.0A 36.0W. With the Coral connected to the new hub, it takes so long for Frigate to find the Coral and start successfully (much, much longer than the TP-Link Hub), I've given up and connected the Coral directly to the other USB 3.0 port on the motherboard with the new cable. At the moment, it's been running without issue for over 12 hours (compared to 9 hours yesterday in the other port before detection stuck).
During testing, after plugging the hub into the other USB 3.0 port (the one the Coral is in now), I did notice when checking the Frigate container logs that the status scrolled through a lot quicker. I wonder if it's a combination of port and cable that's the issue. Anyway, I'll keep an eye on it and see how long it runs for.
I had removed, and recreated the Frigate container but I doubt that has had any significant impact.
So far over 36 hours of uptime and no restarts! With a stable platform, what uptime figures are you seeing? Is an occasional container restart to be expected?
Mine installed monday. One container restart as I went from 4 CPU to 2 CPU and 4->2GB RAM for the LXC container. No hangs/restart aside from that I initiated
It lasted way over 72 hours before detection got stuck, restarted and got stuck again several hours later. I've plugged the Coral back in to the TP-Link powered hub with the new cable and plugged the hub in to the other USB 3.0 port.
The TP-Link has specific ports for high power devices (up to 1.5A). I've plugged the TPU in to one of these and still get the detection has hung message sometime later. So, I've removed the USB TPU completely and plugged in a brand-new M.2 TPU into the wi-fi card socket on the motherboard. So far, inference has reduced from 11-12ms to 8-9ms and it is running fine.
This has been running without issue for quite a few days. Upon restarting Frigate, the M.2 Coral is detected instantly - every time. I think, therefore, this was an issue with either USB port or USB Coral so closing. Many thanks for the input.
Describe the problem you are having
Running Frigate 0.13.1 on Ubuntu Server 22.04.3 LTS in Docker, I've had an issue with a Coral USB TPU getting stuck multiple times a day. After a bit of troubleshooting (moving USB ports etc.) I have found using a powered USB hub the most reliable solution; it stays up for days at a time.
The issue I have now, is that when I restart Frigate (after config changes) Frigate does not immediately find the TPU, it takes 3 or 4 restarts before it actually finds the TPU and starts successfully.
I've tested this on a different PC running Frigate 0.12 in Docker on Ubuntu Server 20.04.6 LTS with the same results. When the Coral TPU is plugged in to a USB port on the PC, Frigate finds the device after the first restart every time.
Is there something I'm missing, or is there something I can do (maybe add a delay) to help?
Hardware:
Dell Vostro 3470 Intel i5 8400 16GB RAM 240GB M.2 SSD
Version
0.13.1
Frigate config file
docker-compose file or Docker CLI command
Relevant log output
Operating system
Other Linux
Install method
Docker Compose
Coral version
USB
Any other information that may be helpful
No response