Bug 31154 - Zoneminder freeze PC when network connection is down
Summary: Zoneminder freeze PC when network connection is down
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 8
Hardware: x86_64 Linux
Priority: Normal critical
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-20 09:40 CET by Eric Petit
Modified: 2022-11-28 21:40 CET (History)
3 users (show)

See Also:
Source RPM: zoneminder.1.34.22.1.1.mga8.tainted
CVE:
Status comment:


Attachments
Full log from 06:00 compressed (71.51 KB, application/x-xz)
2022-11-21 11:37 CET, Lewis Smith
Details
NetworkManager messages only from 06:00 (39.99 KB, text/plain)
2022-11-21 11:38 CET, Lewis Smith
Details

Description Eric Petit 2022-11-20 09:40:19 CET
Hi
I have a PC with following network conf

A router H, huwaei with 4g sim to provide internet.
Behind a router GlInet to manage network and provide openvpn.
a pc with zoneminder setup with only one USB webcam.

Evry 6 hours, i restart the 2 routers.

Often at 6 o'clock, PC freeze.

If i do : systemctl mask  zoneminder.service
PC didn't freeze during 4 days.
Eric Petit 2022-11-20 09:40:55 CET

CC: (none) => surfzoid

Comment 1 Eric Petit 2022-11-20 09:46:56 CET
i forgot.
PC have a wired connection to GlInet, GlInet manage openvpn itself; a wifi connection to Huawei and a script to connect to openvpn if wired connection is done and disconnect openvpn when wired connection is up.
Comment 2 Lewis Smith 2022-11-20 15:28:11 CET
Thank you for the report.
I think this is what you describe:

    |- Ethernet - router GlInet + openvpn - Internet
PC -|
    |- [openvpn if Ethernet down] - WiFi - router H - Internet

By 'freeze', do you mean you cannot do anything? No keyboard nor mouse? You have to re-boot?

(In reply to Eric Petit from comment #0)
> Every 6 hours, i restart the 2 routers.
> Often at 6 o'clock, PC freeze.
Are you saying that the freezes happen only at 06H, not 12/18/24 ?

Please attach the last part of the system journal leading up to the freeze. Doing this from the next necessarily rebooted session, first look at the journal with:
 # journalctl -b -1 --no-hostname
      [prev session] [shortens lines]
then either do select-paste from terminal into a text document; or more refined, note the relevant date and timestamp, then select just the relevant end part with:
 # journalctl -b -1 --no-hostname -S "yyyy-mm-dd hh:mm:ss" > anyfile.txt
                                [de] [aaaa-mm-jj]
and attach the text file to this bug. It should be small.

CC: (none) => lewyssmith

Comment 3 Eric Petit 2022-11-20 19:24:12 CET
(In reply to Lewis Smith from comment #2)
> Thank you for the report.
Another info, glinet restart again at 06h05
Glinet is behind the H, H is the only internet access, but your draw is right.
Freeze need hard reboot from power suply.
yes, only at 06H.
i need to unmask zoneminder and wait tomorrow?
Also i disabled all zoneminder logs.

journalctl -b -1 --no-hostname [prev session] [shortens lines]
Failed to add match '[prev': Argument invalide

journalctl -b -1 --no-hostname
-- Logs begin at Sat 2022-11-19 00:05:46 CET, end at Sun 2022-11-20 18:58:54 CET. --
nov. 20 09:21:38 kernel: Linux version 5.15.74-desktop-1.mga8 (iurt@ecosse.mageia.o ...

it start after 06H but

journalctl -b -2 --no-hostname
-- Logs begin at Sat 2022-11-19 00:05:46 CET, end at Sun 2022-11-20 19:00:24 CET. --
nov. 20 00:05:45 kernel: Linux version 5.15.74-desktop-1.mga8 (iurt@ecosse.mageia.o>
nov. 20 00:05:45 kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-5.15.74-desktop-1.m>
nov. 20 00:05:45 kernel: x86/fpu: x87 FPU will use FXSAVE ....

i attach full log : http://pastebin.fr/111869
and, revelant but not sure :http://pastebin.fr/111867
Comment 4 Eric Petit 2022-11-20 19:52:29 CET
After reading log i misunderstood somethings, pc is on 24/24h 
, it back up some files to home, this morning i saw again i wasn't able to connect to it and last backup file was at 05h54,i can access to other devices like cameras.
On site i saw in the paste the pc completely freezed in this situation and so i use now a connected plug to do a hard reset.

But i don't see in the log this hard reboot around 09H.
Comment 5 Eric Petit 2022-11-20 19:56:09 CET
There is perhaps 2 things.
zm
a bug from my script to switch between wifi and eth.
Comment 6 sturmvogel 2022-11-20 19:58:34 CET
Starting from 6 o'clock a python cronjob fails badly for several hours due to connection loss/change.
Comment 7 Lewis Smith 2022-11-20 21:47:46 CET
Eric
You misunderstood the journalctl commands I gave in comment 2. Each of those was one line:
 # journalctl -b -1 --no-hostname
 # journalctl -b -1 --no-hostname -S "yyyy-mm-dd hh:mm:ss" > anyfile.txt
The [.....] comments underneath were just to explain what the parameters meant, assuming you are French.

 http://pastebin.fr/111869
I have downloaded this, and will trim it to attach to this bug.
Not sure what this http://pastebin.fr/111867 is, but it looks to be the same starting from 05h50.
Need to study the NetworkManager lines.
sturmvogel is right. Is there another job that you run only at 06h00 ? The router re-boots at 12/18/00 you say work work.

> i don't see in the log this hard reboot around 09H
The journal stops soon after 09h. Re-booting the machine manually will kill whatever is running, no shutdown, nothing to log! The *next* journal will show the re-boot: there is one per session.
Comment 8 Eric Petit 2022-11-21 07:34:43 CET
Lewis
Yes i'm french.
i replaced 1 by 2 and yyyy-mm-dd hh:mm:ss by 2022-11-20 05h50.
yes, exactly, crontab on PC is :
0 0,6,12,18  Huawei is rebooted
3 0,6,12,18 glinet  is rebooted

writing this remember me i also use Glinet openwrt to reboot it itself.
crontab on glinet
0 0,6,12,18 glinet  is rebooted

I remove glinet from crontab pc

The python script is one of my tool to backup 
https://github.com/surfzoid/HikNetExtractor

I could add error management if i have time.
 
so finally i'm wrong, 09:19:03 should be the time where i switch off power supply, this log is not zoneminder because there is activity between 6H and 9H,  but my wifi/eth switch
Comment 9 Lewis Smith 2022-11-21 11:37:22 CET
Created attachment 13525 [details]
Full log from 06:00 compressed
Comment 10 Lewis Smith 2022-11-21 11:38:34 CET
Created attachment 13526 [details]
NetworkManager messages only from 06:00
Comment 11 Lewis Smith 2022-11-21 12:14:25 CET
Eric

The second attachment should show what is happening on the networks. Does it make sense to you? Your setup as in comment 1 & comment 2 is complicated...
You were certainly in a mess here:
(In reply to Eric Petit from comment #8)
> crontab on PC is :
> 0 0,6,12,18  Huawei is rebooted
> 3 0,6,12,18 glinet  is rebooted
> 
> writing this remember me i also use Glinet openwrt to reboot it itself.
> crontab on glinet
> 0 0,6,12,18 glinet  is rebooted
> 
> I remove glinet from crontab pc
Does this change anything?

> supply, this log is not zoneminder because there is activity between 6H and
> 9H,  but my wifi/eth switch
Do not understand what you mean.

This bug is for Zoneminder. Why do you attribute the freezes to that? Is it not always running?
"Summary     : Video Camera and CCTV Security with Motion Detection
Description :
A CCTV security package with remote access, motion detection and recording"

Are you able to disable or remove it temporarily to see whether the 06h freezes still happen or vanish?
Alternatively, what other cron jobs to you have for the same time? Can you stop those temporarily to make the same test?
Comment 12 Barry Jackson 2022-11-21 18:14:45 CET
(In reply to Lewis Smith from comment #11)

I don't really understand why the routers are being stopped and re-started, however he could use the zmstop and zmrestart scripts or similar to stop and re-start the zoneminder service before and after the router stop/starts to disable it during the network down time as a test or permanently.

Note that zmstop simply stops the zoneminder service whereas zmrestart stops and re-starts httpd, mysqld and zoneminder services in a sane order.
 
The zm scripts are there just for admin/user/my convenience ;)

I run zoneminder with 12 cameras 24/7 and have done for at least 10 years, however my Huawei 4G router also runs 24/7 but I have no vpn complications.

CC: (none) => zen25000

Comment 13 Eric Petit 2022-11-21 19:21:35 CET
Lewis
I had two problem/bug
one is from my script to switch between wifi and eth, the bug result i loose access to pc through openvpn.

the other is zm who freeze the pc to 6H.

in both case, last backup files have 5h54 timestamp.

> supply, this log is not zoneminder because there is activity between 6H and
> 9H,  but my wifi/eth switch
this mean PC running after 5h0
54 but don't have network access, right?

today i unmask zm service and so wait for the next freeze where i hope, we will see in the log no activity after 6H.
i also modified my script for switch net card/openvpn/.

Barry
i guess your zoneminder PC is at home, my huawei router came from aliexpress, i discover after, aliexpress is chines, 6 month of warranty and canot upgrade/change firmware.

this network isn't at home, so i added glinet to get openvpn access and backup security videos at home.
Comment 14 Lewis Smith 2022-11-22 20:58:19 CET
(In reply to Eric Petit from comment #13)
> I had two problem/bug
> one is from my script
> the other is zm who freeze the pc to 6H.
This is not demonstrated. If ZoneMinder runs permanently, why should it be responsible for a freeze at a certain time.
Your setup is complicated:
- re-booting routers
- switching network routes
- openvpn
- backups

You can do several tests as indicated in comment 11, comment 12, which do not even mention suspending the backup process to see whether *that* has something to do with it. You should certainly be able to suspend different activities around or before 06H to pin down which one, or combination thereof, is responsible.
Comment 15 Eric Petit 2022-11-22 21:04:27 CET
Lewis, yes i'm agree with you, i thinked like a harm, zm on pc freeze, zm off pc don't freeze, since i modified my script, yesterday, pc doesn't freeze, we can wait one week to see. 
Modif of my script was to delete disconnect/reconnect rj45, i didn't put any sleep, it was hard, yes :-D
Comment 16 Eric Petit 2022-11-28 14:13:11 CET
Hi
I'm confuse, after removing switch off/on of eth in my script, no more freeze.
i need to review my script but don't understand interaction with ZM.

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 17 Lewis Smith 2022-11-28 21:40:07 CET
Good, and thank you.

Note You need to log in before you can comment on or make changes to this bug.