diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in index 286d83db1..ad43a20d1 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in @@ -246,10 +246,12 @@ sub zmMemInit { sub zmMemVerify { my $monitor = shift; if ( !zmMemAttach( $monitor, $mem_size ) ) { +print "no attach for $$monitor{Id} $mem_size\n"; return( undef ); } my $mem_key = zmMemKey( $monitor ); +print "mem_key for $$monitor{Id} $mem_key\n"; if ( !defined($mem_verified->{$mem_key}) ) { my $sd_size = zmMemRead( $monitor, "shared_data:size", 1 ); if ( $sd_size != $mem_data->{shared_data}->{size} ) { @@ -365,6 +367,7 @@ sub zmMemRead { sub zmMemInvalidate { my $monitor = shift; my $mem_key = zmMemKey($monitor); +print "zmMemInvalidate $$monitor{Id} $mem_key\n"; if ( $mem_key ) { delete $mem_verified->{$mem_key}; zmMemDetach( $monitor ); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm index e41019647..3625270a6 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm @@ -120,6 +120,8 @@ sub zmMemAttach $monitor->{MMapHandle} = \*MMAP; $monitor->{MMapAddr} = $mmap_addr; $monitor->{MMap} = \$mmap; + } else { +print "$$monitor{Id} already defined at $$monitor{MMapAddr}\n"; } return( !undef ); } diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index 3fc5f43e9..26c091976 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -117,7 +117,7 @@ use bytes; # ========================================================================== use constant MAX_CONNECT_DELAY => 10; -use constant MONITOR_RELOAD_INTERVAL => 300; +use constant MONITOR_RELOAD_INTERVAL => 30; use constant SELECT_TIMEOUT => 0.25; # ========================================================================== @@ -320,7 +320,7 @@ while( 1 ) ] ); - #print( "$monitor->{Id}: S:$state, LE:$last_event\n" ); + print( "$monitor->{Id}: S:$state, LE:$last_event\n" ); #print( "$monitor->{Id}: mS:$monitor->{LastState}, mLE:$monitor->{LastEvent}\n" ); if ( $state == STATE_ALARM || $state == STATE_ALERT @@ -415,8 +415,10 @@ while( 1 ) # If necessary reload monitors if ( (time() - $monitor_reload_time) > MONITOR_RELOAD_INTERVAL ) { +print "TIme to reload Monitors " . join(',',keys %monitors ). "\n"; foreach my $monitor ( values(%monitors) ) { +print "imvalidating $$monitor{Id}\n"; # Free up any used memory handle zmMemInvalidate( $monitor ); } @@ -443,7 +445,10 @@ sub loadMonitors or Fatal( "Can't execute: ".$sth->errstr() ); while( my $monitor = $sth->fetchrow_hashref() ) { - next if ( !zmMemVerify( $monitor ) ); # Check shared memory ok + next + if ( !zmMemVerify( $monitor ) ) { +; # Check shared memory ok +} if ( defined($monitors{$monitor->{Id}}->{LastState}) ) {