On 2015/02/05 22:49, Stuart Henderson wrote:
> We currently have an older release of icinga2 (2.2.1) in ports because
> subsequent releases don't startup correctly on OpenBSD - hanging after
> printing "information/DynamicObject: Restoring program state from file ..."
> apparently in the ParallelWorkQueue constructor (called from
> DynamicObject::RestoreObjects() in lib/base/dynamicobject.cpp).
>
> My c++/threads/boost debugging skills are mostly nonexistent at
> present so I haven't gone investigated that further (and apart from
> anything else I'm unsure whether I should be looking in Icinga's
> direction or the OS), but I've noticed that this hang doesn't seem
> to occur for me if icinga2 is started without the -d flag to
> daemonize.
>
> Does anyone else have an icinga2 installation on OpenBSD they could
> test to see what happens for them with this? It takes a fair while to build,
> so I'm copying packages for -current amd64 to http://junkpile.org/i2-224/
> in case that makes testing easier.
So I had a hang overnight with this; thinking it might make sense
to do the same as was done in MacOS and disable vfork (which fixed a
hang there).
Test packages updated and new diff.
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/icinga/core2/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- Makefile 20 Jan 2015 18:42:38 -0000 1.24
+++ Makefile 6 Feb 2015 14:52:02 -0000
@@ -1,14 +1,13 @@
# $OpenBSD: Makefile,v 1.24 2015/01/20 18:42:38 landry Exp $
SHARED_ONLY = Yes
-BROKEN-hppa = undefined reference to `__sync_add_and_fetch_4' when linking
icinga2
+BROKEN-hppa = undefined reference to __sync_add_and_fetch_4 when linking
icinga2
COMMENT-main = network monitoring system
COMMENT-mysql = MySQL support for icinga2
COMMENT-pgsql = PostgreSQL support for icinga2
-V = 2.2.1
+V = 2.2.4
EPOCH = 0
-REVISION-main = 0
GH_ACCOUNT = Icinga
GH_PROJECT = icinga2
GH_TAGNAME = v$V
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/icinga/core2/distinfo,v
retrieving revision 1.6
diff -u -p -r1.6 distinfo
--- distinfo 4 Jan 2015 21:32:24 -0000 1.6
+++ distinfo 6 Feb 2015 14:52:02 -0000
@@ -1,2 +1,2 @@
-SHA256 (icinga2-2.2.1.tar.gz) = Pa9zswz+ymspyMpxXABrTmEjJBZaBYPrBypR0JJe6m0=
-SIZE (icinga2-2.2.1.tar.gz) = 683579
+SHA256 (icinga2-2.2.4.tar.gz) = AynnrRDlcWQHZT63PCVFYWpjPXpwxrf8wt+ZUxae6ao=
+SIZE (icinga2-2.2.4.tar.gz) = 691978
Index: patches/patch-etc_icinga2_scripts_mail-host-notification_sh
===================================================================
RCS file:
/cvs/ports/net/icinga/core2/patches/patch-etc_icinga2_scripts_mail-host-notification_sh,v
retrieving revision 1.1
diff -u -p -r1.1 patch-etc_icinga2_scripts_mail-host-notification_sh
--- patches/patch-etc_icinga2_scripts_mail-host-notification_sh 19 Jun 2014
23:33:09 -0000 1.1
+++ patches/patch-etc_icinga2_scripts_mail-host-notification_sh 6 Feb 2015
14:52:02 -0000
@@ -1,9 +1,9 @@
$OpenBSD: patch-etc_icinga2_scripts_mail-host-notification_sh,v 1.1 2014/06/19
23:33:09 sthen Exp $
---- etc/icinga2/scripts/mail-host-notification.sh.orig Thu Jun 19 14:50:37 2014
-+++ etc/icinga2/scripts/mail-host-notification.sh Thu Jun 19 14:50:46 2014
+--- etc/icinga2/scripts/mail-host-notification.sh.orig Thu Feb 5 10:15:24 2015
++++ etc/icinga2/scripts/mail-host-notification.sh Thu Feb 5 18:17:05 2015
@@ -1,4 +1,4 @@
--#!/usr/bin/env bash
+-#!/bin/sh
+#!/bin/ksh
- template=$(cat <<TEMPLATE
+ template=`cat <<TEMPLATE
***** Icinga *****
Index: patches/patch-etc_icinga2_scripts_mail-service-notification_sh
===================================================================
RCS file: patches/patch-etc_icinga2_scripts_mail-service-notification_sh
diff -N patches/patch-etc_icinga2_scripts_mail-service-notification_sh
--- patches/patch-etc_icinga2_scripts_mail-service-notification_sh 19 Jun
2014 23:33:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-$OpenBSD: patch-etc_icinga2_scripts_mail-service-notification_sh,v 1.1
2014/06/19 23:33:09 sthen Exp $
---- etc/icinga2/scripts/mail-service-notification.sh.orig Thu Jun 19
14:51:56 2014
-+++ etc/icinga2/scripts/mail-service-notification.sh Thu Jun 19 14:52:03 2014
-@@ -1,4 +1,4 @@
--#!/usr/bin/env bash
-+#!/bin/ksh
- template=$(cat <<TEMPLATE
- ***** Icinga *****
-
Index: patches/patch-icinga-app_icinga_cpp
===================================================================
RCS file: patches/patch-icinga-app_icinga_cpp
diff -N patches/patch-icinga-app_icinga_cpp
--- patches/patch-icinga-app_icinga_cpp 22 Nov 2014 00:14:05 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-icinga-app_icinga_cpp,v 1.1 2014/11/22 00:14:05 sthen Exp $
-
-XXX Work around random crashes at program startup. Typically these
-have a corrupt stack, but occasionally the backtrace includes
-Application::SetResourceLimits or related functions.
-
---- icinga-app/icinga.cpp.orig Fri Nov 21 23:49:09 2014
-+++ icinga-app/icinga.cpp Fri Nov 21 23:49:30 2014
-@@ -103,8 +103,10 @@ int Main(void)
-
- Application::SetStartTime(Utility::GetTime());
-
-+#if 0
- if (!autocomplete)
- Application::SetResourceLimits();
-+#endif
-
- /* Set thread title. */
- Utility::SetThreadName("Main Thread", false);
Index: patches/patch-lib_base_stacktrace_cpp
===================================================================
RCS file: /cvs/ports/net/icinga/core2/patches/patch-lib_base_stacktrace_cpp,v
retrieving revision 1.3
diff -u -p -r1.3 patch-lib_base_stacktrace_cpp
--- patches/patch-lib_base_stacktrace_cpp 22 Nov 2014 00:13:03 -0000
1.3
+++ patches/patch-lib_base_stacktrace_cpp 6 Feb 2015 14:52:02 -0000
@@ -1,15 +1,14 @@
$OpenBSD: patch-lib_base_stacktrace_cpp,v 1.3 2014/11/22 00:13:03 sthen Exp $
---- lib/base/stacktrace.cpp.orig Mon Nov 17 09:52:21 2014
-+++ lib/base/stacktrace.cpp Thu Nov 20 20:03:27 2014
+--- lib/base/stacktrace.cpp.orig Fri Jan 9 13:46:07 2015
++++ lib/base/stacktrace.cpp Fri Jan 16 19:52:21 2015
@@ -21,9 +21,9 @@
#include "base/utility.hpp"
#include "base/initialize.hpp"
-#ifdef HAVE_BACKTRACE_SYMBOLS
--# include <execinfo.h>
--#endif /* HAVE_BACKTRACE_SYMBOLS */
+#if Backtrace_FOUND
-+# include <${Backtrace_HEADER}>
+ # include <execinfo.h>
+-#endif /* HAVE_BACKTRACE_SYMBOLS */
+#endif /* Backtrace_FOUND */
using namespace icinga;
Index: patches/patch-lib_cli_daemoncommand_cpp
===================================================================
RCS file: patches/patch-lib_cli_daemoncommand_cpp
diff -N patches/patch-lib_cli_daemoncommand_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_cli_daemoncommand_cpp 6 Feb 2015 14:52:02 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- lib/cli/daemoncommand.cpp.orig Fri Feb 6 09:17:06 2015
++++ lib/cli/daemoncommand.cpp Fri Feb 6 09:19:38 2015
+@@ -324,7 +324,7 @@ int DaemonCommand::Run(const po::variables_map& vm, co
+ if (!vm.count("validate"))
+ Logger::DisableTimestamp(false);
+
+-#ifdef __APPLE__
++#if defined(__APPLE__) || defined(__OpenBSD__)
+ ScriptVariable::Set("UseVfork", false, false, true);
+ #else /* __APPLE__ */
+ ScriptVariable::Set("UseVfork", true, false, true);
Index: patches/patch-third-party_execvpe_execvpe_c
===================================================================
RCS file: patches/patch-third-party_execvpe_execvpe_c
diff -N patches/patch-third-party_execvpe_execvpe_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-third-party_execvpe_execvpe_c 6 Feb 2015 14:52:02 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- third-party/execvpe/execvpe.c.orig Fri Jan 16 19:54:06 2015
++++ third-party/execvpe/execvpe.c Fri Jan 16 19:54:31 2015
+@@ -17,7 +17,7 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+-#ifndef __FreeBSD__
++#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
+ #include <alloca.h>
+ #endif /* _FreeBSD__ */
+ #include <unistd.h>
Index: pkg/README-main
===================================================================
RCS file: /cvs/ports/net/icinga/core2/pkg/README-main,v
retrieving revision 1.7
diff -u -p -r1.7 README-main
--- pkg/README-main 17 Dec 2014 22:10:30 -0000 1.7
+++ pkg/README-main 6 Feb 2015 14:52:02 -0000
@@ -29,17 +29,15 @@ on the local machine; these should work
You may check your configuration file format before starting Icinga:
- $ sudo -u _icinga ${TRUEPREFIX}/sbin/icinga2 daemon -C
+ $ sudo -u _icinga icinga2 daemon -C
This will parse all configuration files and warn about any problems
which have been identified.
-To enable automatic startup on boot for icinga2, add it to the pkg_scripts
-line in /etc/rc.conf.local.
+Enable icinga2 at boot and start it as usual:
-To start icinga2, reboot or start it manually:
-
- $ sudo ${RCDIR}/icinga2 start
+ # rcctl enable icinga2
+ # rcctl start icinga2
Web User-Interfaces
===================
Index: pkg/icinga2.rc
===================================================================
RCS file: /cvs/ports/net/icinga/core2/pkg/icinga2.rc,v
retrieving revision 1.2
diff -u -p -r1.2 icinga2.rc
--- pkg/icinga2.rc 22 Nov 2014 00:13:03 -0000 1.2
+++ pkg/icinga2.rc 6 Feb 2015 14:52:02 -0000
@@ -2,13 +2,13 @@
#
# $OpenBSD: icinga2.rc,v 1.2 2014/11/22 00:13:03 sthen Exp $
-daemon="${TRUEPREFIX}/sbin/icinga2 daemon -d"
-daemon_flags=""
+daemon="${TRUEPREFIX}/sbin/icinga2 daemon"
daemon_user="_icinga"
. /etc/rc.d/rc.subr
-pexp="${TRUEPREFIX}/sbin/icinga2.*daemon -d${daemon_flags:+ ${daemon_flags}}"
+pexp="${TRUEPREFIX}/sbin/icinga2.*daemon${daemon_flags:+ ${daemon_flags}}"
+rc_bg=YES
rc_pre() {
install -d -o ${daemon_user} /var/run/icinga2