diff --git a/frigate/app.py b/frigate/app.py index 1e000d401..a6994d6d9 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -180,14 +180,23 @@ class FrigateApp: model_shape = (self.config.model.height, self.config.model.width) for name in self.config.cameras.keys(): self.detection_out_events[name] = mp.Event() - shm_in = mp.shared_memory.SharedMemory( - name=name, - create=True, - size=self.config.model.height * self.config.model.width * 3, - ) - shm_out = mp.shared_memory.SharedMemory( - name=f"out-{name}", create=True, size=20 * 6 * 4 - ) + + try: + shm_in = mp.shared_memory.SharedMemory( + name=name, + create=True, + size=self.config.model.height*self.config.model.width * 3, + ) + except FileExistsError: + shm_in = mp.shared_memory.SharedMemory(name=name) + + try: + shm_out = mp.shared_memory.SharedMemory( + name=f"out-{name}", create=True, size=20 * 6 * 4 + ) + except FileExistsError: + shm_out = mp.shared_memory.SharedMemory(name=f"out-{name}") + self.detection_shms.append(shm_in) self.detection_shms.append(shm_out)