Cannot create new events. Database errors.
Posted: Mon Sep 20, 2021 4:51 pm
Hello. I am new to ZM and I have encountered an issue. I am sometimes getting the following error messages in my logs. When I do, new events aren't being created on the monitor(s) in question.
Sep 20 12:37:57 zm zmc_m4[32427]: ERR [zmc_m4] [Can't run query INSERT INTO `Frames` (`EventId`, `FrameId`, `Type`, `TimeStamp`, `Delta`, `Score`) VALUES #012( 189176, 29, 'Normal', from_unixtime( 1632155875 ), 4.60, 0 ),#012( 189176, 30, 'Normal', from_unixtime( 1632155875 ), 4.75, 0 ),#012( 189176, 31, 'Normal', from_unixtime( 1632155876 ), 4.95, 0 ),#012( 189176, 32, 'Normal', from_unixtime( 1632155876 ), 5.09, 0 ),#012( 189176, 33, 'Alarm', from_unixtime( 1632155876 ), 5.24, 2 ),#012( 189176, 34, 'Alarm', from_unixtime( 1632155876 ), 5.45, 3 ),#012( 189176, 35, 'Alarm', from_unixtime( 1632155876 ), 5.60, 6 ): Cannot add or update a child row: a foreign key constraint fails (`zm`.`Frames`, CONSTRAINT `Frames_ibfk_1` FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE)]
Sep 20 12:37:58 zm zmc_m1[32413]: INF [zmc_m1] [Front Porch: 321 - Gone into alarm state PreAlarmCount: 4 > AlarmFrameCount:5 Cause:Motion Right]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't run query INSERT INTO `Stats` (`EventId`, `FrameId`, `MonitorId`, `ZoneId`, `PixelDiff`, `AlarmPixels`, `FilterPixels`, `BlobPixels`,`Blobs`,`MinBlobSize`, `MaxBlobSize`, `MinX`, `MinY`, `MaxX`, `MaxY`,`Score`) VALUES #012(189176,29,4,8,28,2177,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,21,29,293,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,8,28,1724,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,21,35,347,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,8,26,1715,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,21,27,230,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,8,27,2316,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,21,32,335,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,8,29,2653,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,21,56,530,0,0,0,0,0,0,0,0,0,2),#012(189176,33,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,8,37,2858,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,21,69,939,0,0,0,0,0,0,0,0,0,3),#012(189176,34,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,8,38,3926,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,21,76,1640,0,0,0,0,0,0,0,0,0,6),#012(189176,35,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,13,0,0,0,0,0,0,0,0,0,0,0,0): Cannot add or update a child row: a foreign key constraint fails (`zm`.`Stats`, CONSTRAINT `Stats_ibfk_3` FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE)]
Sep 20 12:37:58 zm zmc_m2[32417]: INF [zmc_m2] [Back Porch: 350 - Gone into prealarm state]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Can't open /zm/3/2021-09-20/189175/00054-capture.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Failed to write frame image]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Can't open /zm/3/2021-09-20/189175/00054-analyse.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Failed to write analysis frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00043-capture.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Failed to write frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00043-analyse.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Failed to write analysis frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00044-capture.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Failed to write frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00044-analyse.jpg for writing: No such file or directory]
For these errors, it seems like I can "fix" the problem by deleting the most recent event for the monitor. I have no idea if or what I am doing that would cause them to start happening.
Can somebody help me?
Sep 20 12:37:57 zm zmc_m4[32427]: ERR [zmc_m4] [Can't run query INSERT INTO `Frames` (`EventId`, `FrameId`, `Type`, `TimeStamp`, `Delta`, `Score`) VALUES #012( 189176, 29, 'Normal', from_unixtime( 1632155875 ), 4.60, 0 ),#012( 189176, 30, 'Normal', from_unixtime( 1632155875 ), 4.75, 0 ),#012( 189176, 31, 'Normal', from_unixtime( 1632155876 ), 4.95, 0 ),#012( 189176, 32, 'Normal', from_unixtime( 1632155876 ), 5.09, 0 ),#012( 189176, 33, 'Alarm', from_unixtime( 1632155876 ), 5.24, 2 ),#012( 189176, 34, 'Alarm', from_unixtime( 1632155876 ), 5.45, 3 ),#012( 189176, 35, 'Alarm', from_unixtime( 1632155876 ), 5.60, 6 ): Cannot add or update a child row: a foreign key constraint fails (`zm`.`Frames`, CONSTRAINT `Frames_ibfk_1` FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE)]
Sep 20 12:37:58 zm zmc_m1[32413]: INF [zmc_m1] [Front Porch: 321 - Gone into alarm state PreAlarmCount: 4 > AlarmFrameCount:5 Cause:Motion Right]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't run query INSERT INTO `Stats` (`EventId`, `FrameId`, `MonitorId`, `ZoneId`, `PixelDiff`, `AlarmPixels`, `FilterPixels`, `BlobPixels`,`Blobs`,`MinBlobSize`, `MaxBlobSize`, `MinX`, `MinY`, `MaxX`, `MaxY`,`Score`) VALUES #012(189176,29,4,8,28,2177,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,21,29,293,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,29,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,8,28,1724,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,21,35,347,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,30,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,8,26,1715,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,21,27,230,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,31,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,8,27,2316,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,21,32,335,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,32,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,8,29,2653,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,21,56,530,0,0,0,0,0,0,0,0,0,2),#012(189176,33,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,33,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,8,37,2858,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,21,69,939,0,0,0,0,0,0,0,0,0,3),#012(189176,34,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,34,4,13,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,8,38,3926,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,21,76,1640,0,0,0,0,0,0,0,0,0,6),#012(189176,35,4,10,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,11,0,0,0,0,0,0,0,0,0,0,0,0),#012(189176,35,4,13,0,0,0,0,0,0,0,0,0,0,0,0): Cannot add or update a child row: a foreign key constraint fails (`zm`.`Stats`, CONSTRAINT `Stats_ibfk_3` FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE)]
Sep 20 12:37:58 zm zmc_m2[32417]: INF [zmc_m2] [Back Porch: 350 - Gone into prealarm state]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Can't open /zm/3/2021-09-20/189175/00054-capture.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Failed to write frame image]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Can't open /zm/3/2021-09-20/189175/00054-analyse.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m3[32422]: ERR [zmc_m3] [Failed to write analysis frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00043-capture.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Failed to write frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00043-analyse.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Failed to write analysis frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00044-capture.jpg for writing: No such file or directory]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Failed to write frame image]
Sep 20 12:37:58 zm zmc_m4[32427]: ERR [zmc_m4] [Can't open /zm/4/2021-09-20/189176/00044-analyse.jpg for writing: No such file or directory]
For these errors, it seems like I can "fix" the problem by deleting the most recent event for the monitor. I have no idea if or what I am doing that would cause them to start happening.
Can somebody help me?