pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

zoneminder: Add kludgy patch to avoid startup failure



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Mon Jun 5 09:10:31 2023 -0400
Changeset:	20a059fa76703ebde315a28766953c2acb3f7462

Modified Files:
	zoneminder/Makefile
	zoneminder/distinfo
	zoneminder/patches/patch-scripts_zmpkg_pl_in

Log Message:
zoneminder: Add kludgy patch to avoid startup failure

The first 'zmdc.pl startup' hangs, and I suspect a race with 'zmdc.pl
start'.  Avoid a race that might or might not exist with a sleep,
which fixes the hang for me.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=20a059fa76703ebde315a28766953c2acb3f7462

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 zoneminder/Makefile                          |  2 +-
 zoneminder/distinfo                          |  2 +-
 zoneminder/patches/patch-scripts_zmpkg_pl_in | 29 +++++++++++++++++++++++-----
 3 files changed, 26 insertions(+), 7 deletions(-)

diffs:
diff --git a/zoneminder/Makefile b/zoneminder/Makefile
index a2e0e399e8..f5c191cae9 100644
--- a/zoneminder/Makefile
+++ b/zoneminder/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.42 2019/06/18 12:36:59 gdt Exp $
 
 VERSION=	1.32.3
-PKGREVISION=	6
+PKGREVISION=	7
 # Distfile is ZoneMinder but package and tarball contents are zoneminder.
 NAME_DIST=	ZoneMinder
 NAME_LOWER=	zoneminder
diff --git a/zoneminder/distinfo b/zoneminder/distinfo
index 3f970117bd..273f84a9e3 100644
--- a/zoneminder/distinfo
+++ b/zoneminder/distinfo
@@ -15,7 +15,7 @@ SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in) = 3bf4e5e8276a68
 SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm) = 84a1db650e90aa8e4dfe4c7633f1e5b41022fd01
 SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_Memory_Shared.pm) = b97c104f6ac102fc4510eb0977169375cdd97197
 SHA1 (patch-scripts_zm_in) = a05727261bb8be6b707e9a14ae4ff52ea3770d51
-SHA1 (patch-scripts_zmpkg_pl_in) = 1dd13f9d3a5901e89ff8ac6062de9272dbea2d58
+SHA1 (patch-scripts_zmpkg_pl_in) = eb3166ae3cd9bb0ce1b828b64722506aa4e82368
 SHA1 (patch-src_zm__event.cpp) = ba65b91fd62c2840819a71b23ffdae87b0ebe487
 SHA1 (patch-src_zm__eventstream.cpp) = 63040024a69c9362e544e8950da57d831824f2f8
 SHA1 (patch-src_zm__monitor.cpp) = 5611aa37187bc9910ba1ccd9ddd5d0f421438b53
diff --git a/zoneminder/patches/patch-scripts_zmpkg_pl_in b/zoneminder/patches/patch-scripts_zmpkg_pl_in
index 14cb56dd67..0050841335 100644
--- a/zoneminder/patches/patch-scripts_zmpkg_pl_in
+++ b/zoneminder/patches/patch-scripts_zmpkg_pl_in
@@ -1,11 +1,14 @@
 $NetBSD$
 
-The systemd check in zmpkg.pl does not work, even on systems that use systemd.
-It fails to start, eventually timing out, if there is any parent process
-between zmpkg.pl and systemd or init - such as /etc/init.d/zoneminder
+The systemd check in zmpkg.pl does not work, even on systems that use
+systemd.  It fails to start, eventually timing out, if there is any
+parent process between zmpkg.pl and systemd or init - such as
+/etc/init.d/zoneminder.  But everything does seem to work ok from
+systemd without this roundabout code anyway, so just inhibit it.
 
-But everything does seem to work ok from systemd without this roundabout code
-anyway, so just inhibit it.
+Add sleep to avoid suspected race condition.
+
+\todo After catching up, actually debug and/or send upstream.
 
 --- scripts/zmpkg.pl.in.orig	2018-12-08 14:22:36.000000000 +0000
 +++ scripts/zmpkg.pl.in
@@ -18,3 +21,19 @@ anyway, so just inhibit it.
  # We have to detaint to keep perl from complaining
    $command = $1;
  
+@@ -191,6 +191,15 @@ if ( $command =~ /^(?:start|restart)$/ )
+ 
+     zmMemTidy();
+     runCommand('zmdc.pl startup');
++    Info("Sleeping 2 seconds to avoid zmdc.pl race.");
++    # Somehow, on at least NetBSD 9 amd64, a future zmdc.pl start
++    # command succeeds in starting the daemon, but does not exit.
++    # Based on an unsubstantiated theory that the startup invocation
++    # exits before startup is complete, sleep for 2 seconds
++    # afterwards.  Experimentally, this results in normal startup
++    # without hanging.
++    sleep(2);
++    Info("Sleeping complete.");
+ 
+     my $Server = undef;
+     my $sql;


Home | Main Index | Thread Index | Old Index