zmcontrol lock-up fix

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
jbnsec
Posts: 3
Joined: Thu Aug 22, 2019 12:39 am

zmcontrol lock-up fix

Post by jbnsec »

Possibly this has been addressed already, but I couldn't find anything on it so I am posting it here.

While using v1.32.3 I ran into an issue where zmcontrol.pl would occasionally get stuck in a loop that consumed memory until it brought up the OOM killer, or froze the server. I noticed it while using the PTZ controls (with the wrong PTZ control defined) - or using the PTZ controls (with the correct control type defined) and then restarting the server. Additionally, passing the wrong control type to the script would have the same effect. I am not sure if it applies to all the Control scripts or not.

Resolving it just entailed adding in a check to see if the control object had the function being called before passing it off:

Code: Select all

          $control->$command($params);
on line 176 of zmcontrol.pl was adjusted to

Code: Select all

          if($control->can("$command")) {
            $control->$command($params);
            }
          else {
            Error("Invalid command attempted for server $id/$protocol");
            }
which includes error reporting.

Also, thanks for all the hard work on a wonderful piece of software!

JB
Post Reply