zmtrigger - Variable is not a string in Memory Mapped

Forum for questions and support relating to the 1.28.x releases only.
Locked
RecordEverything
Posts: 5
Joined: Tue Apr 01, 2014 8:20 am

zmtrigger - Variable is not a string in Memory Mapped

Post by RecordEverything »

My zmtrigger is exiting randomly - usually every 5-20mins with the following:

variable is not a string at /usr/share/perl/5.18.2/ZoneMinder/Memory/Mapped.pm line 125.

The line in question is: if ( ! munmap( ${$monitor->{MMap}} ) ) {


I have no idea what's triggering it. It doesn't seem to be related external events coming into zmtrigger but I can't be more specific at the moment - logging hasn't offered anything.. zmtrigger seems to work until it crashes.

If you search for this bug on the forums its been around since 1.24 and is complained about in most versions. What can we do to fix it?
User avatar
iconnor
Posts: 3276
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: zmtrigger - Variable is not a string in Memory Mapped

Post by iconnor »

I tried to investigate this once, to no avail.

You could try adding a logging statement before that line to see what $monitor->MMAP is.

Something like Warn( "MMAP is $$monitor{MMAP}" );
RecordEverything
Posts: 5
Joined: Tue Apr 01, 2014 8:20 am

Re: zmtrigger - Variable is not a string in Memory Mapped

Post by RecordEverything »

That resulted in this:

Use of uninitialized value in concatenation (.) or string at /usr/share/perl/5.18.2/ZoneMinder/Memory/Mapped.pm line 123.
Undefined subroutine &ZoneMinder::Memory::Mapped::Warn called at /usr/share/perl/5.18.2/ZoneMinder/Memory/Mapped.pm line 123.

I don't have time to debug this further tonight but i'll dive in. I gather that the variable isn't being passed.
RecordEverything
Posts: 5
Joined: Tue Apr 01, 2014 8:20 am

Re: zmtrigger - Variable is not a string in Memory Mapped

Post by RecordEverything »

Code: Select all


This bug appears to be caused by the periodic reloading of Monitors by zmtrigger and the fact it calls "zmMemInvalidate" before that happens. 


sub zmMemDetach( $ )
{
        my $monitor = shift;

        if(!defined($monitor)) {
                print localtime()." Monitor not defined\n";
                return;
        }
        if(!defined($$monitor{MMAP})) {
                print localtime()." Monitor MMAP not defined with monitor $monitor\n";
                print localtime()." Dump Monitor\n";
                print Dumper($monitor);
                print "Done....\n";
                return;
        }

and in zmtrigger:

        if ( (time() - $monitor_reload_time) > MONITOR_RELOAD_INTERVAL )
        {
            foreach my $monitor ( values(%monitors) )
        {
            # Free up any used memory handle
            print localtime()." zmMemInvalidate for $monitor\n";
            zmMemInvalidate( $monitor );
        }
                loadMonitors();
        }


This results in...

Thu Jan 22 19:40:29 2015 zmMemInvalidate for HASH(0x124ef68)
Thu Jan 22 19:40:29 2015 Monitor MMAP not defined with monitor HASH(0x124ef68)
Thu Jan 22 19:40:29 2015 Dump Monitor
$VAR1 = {
          'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
          'TrackDelay' => '0',
          'Enabled' => '1',
          'FrameSkip' => '0',
          'Function' => 'Modect',
          'SubPath' => '',
          'DefaultRate' => '100',
          'EventPrefix' => 'Motion-',
          'LabelX' => '0',
          'PreEventCount' => '25',
          'Path' => '/video2.mjpg',
          'AlarmMaxFPS' => '0.00',
          'ImageBufferCount' => '50',
          'Type' => 'Remote',
          'LastEvent' => 46966,
          'Port' => '80',
          'MotionFrameSkip' => '0',
          'WarmupCount' => '25',
          'Triggers' => '',
          'AutoStopTimeout' => undef,
          'ControlAddress' => undef,
          'Hue' => '-1',
          'PostEventCount' => '25',
          'LabelY' => '790',
          'User' => '',
          'RefBlendPerc' => '25',
          'DefaultView' => 'Events',
          'MMap' => \'Pv·ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿà.­áÀT­áÀT0',
          'DefaultScale' => '50',
          'MaxFPS' => '0.00',
          'Pass' => '',
          'Colours' => '3',
          'V4LMultiBuffer' => undef,
          'Palette' => '0',
          'ReturnLocation' => '-1',
          'Width' => '1280',
          'Device' => '/dev/video0',
          'Channel' => '0',
          'Host' => 'admin:cdfdfgre@192.168.2.249',
          'StreamReplayBuffer' => '1000',
          'Protocol' => 'http',
          'ReturnDelay' => '0',
          'V4LCapturesPerFrame' => undef,
          'SectionLength' => '600',
          'Contrast' => '-1',
          'ControlId' => '0',
          'MMapAddr' => '140429154336768',
          'FPSReportInterval' => '400',
          'Colour' => '-1',
          'Method' => 'simple',
          'Deinterlacing' => '0',
          'Name' => 'Cam2',
          'AlarmRefBlendPerc' => '25',
          'Format' => '255',
          'Height' => '800',
          'Controllable' => '0',
          'ControlDevice' => undef,
          'MMapHandle' => \*ZoneMinder::Memory::Mapped::MMAP,
          'Id' => '2',
          'Brightness' => '-1',
          'LastState' => 0,
          'Sequence' => '2',
          'AlarmFrameCount' => '2',
          'SignalCheckColour' => '#0000c0',
          'TrackMotion' => '0',
          'WebColour' => 'red',
          'LinkedMonitors' => '',
          'Orientation' => '0',
          'Options' => ''
        };
Done....
Thu Jan 22 19:40:29 2015 zmMemInvalidate for HASH(0x124e770)
Thu Jan 22 19:40:29 2015 Monitor MMAP not defined with monitor HASH(0x124e770)
Thu Jan 22 19:40:29 2015 Dump Monitor
$VAR1 = {
          'Deinterlacing' => '0',
          'Method' => 'simple',
          'MMapAddr' => '140429154340864',
          'FPSReportInterval' => '200',
          'Colour' => '-1',
          'ControlId' => '0',
          'Contrast' => '-1',
          'Protocol' => 'http',
          'StreamReplayBuffer' => '1000',
          'SectionLength' => '600',
          'V4LCapturesPerFrame' => undef,
          'ReturnDelay' => '0',
          'Host' => 'admin:poipofks@192.168.2.248',
          'Channel' => '0',
          'Width' => '1280',
          'Device' => '/dev/video0',
          'Orientation' => '0',
          'Options' => '',
          'LinkedMonitors' => '',
          'WebColour' => 'red',
          'LastState' => 0,
          'Sequence' => '1',
          'Brightness' => '-1',
          'AlarmFrameCount' => '2',
          'SignalCheckColour' => '#0000c0',
          'TrackMotion' => '0',
          'Controllable' => '0',
          'MMapHandle' => \*ZoneMinder::Memory::Mapped::MMAP,
          'Id' => '1',
          'ControlDevice' => undef,
          'Height' => '800',
          'Format' => '255',
          'AlarmRefBlendPerc' => '12',
          'Name' => 'Cam1',
          'LastEvent' => 46969,
          'Type' => 'Remote',
          'AlarmMaxFPS' => '0.00',
          'ImageBufferCount' => '50',
          'MotionFrameSkip' => '0',
          'Port' => '80',
          'PreEventCount' => '25',
          'Path' => '/video2.mjpg',
          'EventPrefix' => 'Motion-',
          'DefaultRate' => '100',
          'LabelX' => '0',
          'SubPath' => '',
          'Function' => 'Modect',
          'Enabled' => '1',
          'FrameSkip' => '0',
          'TrackDelay' => '0',
          'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
          'Palette' => '0',
          'ReturnLocation' => '-1',
          'V4LMultiBuffer' => undef,
          'Colours' => '3',
          'DefaultScale' => '50',
          'Pass' => '',
          'MaxFPS' => '0.00',
          'LabelY' => '790',
          'MMap' => \y·ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿà.­áÀT­áÀT0',
          'User' => '',
          'RefBlendPerc' => '12',
          'DefaultView' => 'Events',
          'ControlAddress' => undef,
          'PostEventCount' => '25',
          'Hue' => '-1',
          'Triggers' => '',
          'AutoStopTimeout' => undef,
          'WarmupCount' => '25'
        };
Done....
Thu Jan 22 19:40:29 2015 zmMemInvalidate for HASH(0x12543c8)
Thu Jan 22 19:40:29 2015 Monitor MMAP not defined with monitor HASH(0x12543c8)
Thu Jan 22 19:40:29 2015 Dump Monitor
$VAR1 = {
          'Orientation' => '0',
          'Options' => '',
          'WebColour' => 'red',
          'LinkedMonitors' => '',
          'LastState' => 0,
          'Sequence' => '3',
          'AlarmFrameCount' => '2',
          'Brightness' => '-1',
          'SignalCheckColour' => '#0000c0',
          'TrackMotion' => '0',
          'Controllable' => '0',
          'ControlDevice' => undef,
          'Id' => '3',
          'MMapHandle' => \*ZoneMinder::Memory::Mapped::MMAP,
          'Height' => '800',
          'AlarmRefBlendPerc' => '25',
          'Format' => '255',
          'Name' => 'Cam3',
          'Deinterlacing' => '0',
          'Method' => 'simple',
          'MMapAddr' => '140429154332672',
          'FPSReportInterval' => '400',
          'Colour' => '-1',
          'Contrast' => '-1',
          'ControlId' => '0',
          'StreamReplayBuffer' => '1000',
          'Protocol' => 'http',
          'ReturnDelay' => '0',
          'V4LCapturesPerFrame' => undef,
          'SectionLength' => '300',
          'Channel' => '0',
          'Host' => 'admin:cvxcxvxref@192.168.2.247',
          'Width' => '1280',
          'Device' => '/dev/video0',
          'Palette' => '0',
          'ReturnLocation' => '-1',
          'V4LMultiBuffer' => undef,
          'Colours' => '3',
          'DefaultScale' => '50',
          'MaxFPS' => '7.00',
          'Pass' => '',
          'LabelY' => '790',
          'DefaultView' => 'Events',
          'User' => '',
          'RefBlendPerc' => '25',
          'MMap' => \'Pt·ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿà.­áÀT¬áÀT0PIRCancel',
          'PostEventCount' => '25',
          'Hue' => '-1',
          'ControlAddress' => undef,
          'Triggers' => '',
          'AutoStopTimeout' => undef,
          'WarmupCount' => '25',
          'ImageBufferCount' => '50',
          'AlarmMaxFPS' => '7.00',
          'Type' => 'Remote',
          'LastEvent' => 46964,
          'Port' => '80',
          'MotionFrameSkip' => '0',
          'PreEventCount' => '25',
          'Path' => '/video2.mjpg',
          'DefaultRate' => '100',
          'EventPrefix' => 'Motion-',
          'LabelX' => '0',
          'SubPath' => '',
          'FrameSkip' => '0',
          'Enabled' => '1',
          'Function' => 'Modect',
          'TrackDelay' => '0',
          'LabelFormat' => '%N - %d/%m/%y %H:%M:%S'
        };
Done....
Thu Jan 22 19:40:29 2015Loading monitors

(Passwords have been edited, before anyone wonders)


PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: zmtrigger - Variable is not a string in Memory Mapped

Post by PacoLM »

RecordEverything wrote:

Code: Select all

          'Host' => 'admin:cdfdfgre@192.168.2.249',
          'Host' => 'admin:poipofks@192.168.2.248',
          'Host' => 'admin:cvxcxvxref@192.168.2.247',
(Passwords have been edited, before anyone wonders)
You are using a intranet, so first we need to guess another password to get into your system ;)

PacoLM

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
Locked