Adjust the icinga2 port:
- Replace previous backout with fixes from Gunnar Beutner (upstream): . Make sure the timer thread is gone when calling fork() . Ensure that the main thread pool gets re-initialized properly after fork() - Add a check so that 'make test' fails early with a useful error if the libconfig package is installed; the objects in the build directory don't have a finalized rpath and they are looking in /usr/local/lib before the build directory, so the wrong libconfig so is picked up. I think this port should now be in good shape, please let me know if you're using it and run into problems with forking etc.
This commit is contained in:
parent
cde529c1db
commit
ea11becfae
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.35 2015/10/20 21:34:29 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.36 2015/10/21 09:03:22 sthen Exp $
|
||||
|
||||
BROKEN-hppa = needs 64-bit atomic ops; __sync_add_and_fetch_4
|
||||
SHARED_ONLY = Yes
|
||||
@ -8,7 +8,7 @@ COMMENT-mysql = MySQL support for icinga2
|
||||
COMMENT-pgsql = PostgreSQL support for icinga2
|
||||
|
||||
V = 2.3.11
|
||||
REVISION = 0
|
||||
REVISION = 1
|
||||
EPOCH = 0
|
||||
GH_ACCOUNT = Icinga
|
||||
GH_PROJECT = icinga2
|
||||
@ -75,10 +75,10 @@ post-install:
|
||||
chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/share/examples/icinga2/syntax
|
||||
chmod -R u=rwX,g=rX,o=rX ${PREFIX}/share/examples/icinga2/syntax
|
||||
|
||||
# XXX this target isn't actually needed in order to run the tests, but they
|
||||
# are all failing for me with ld.so errors (possibly rpath-related) and
|
||||
# the -V makes it more obvious what's going on.
|
||||
do-test:
|
||||
cd ${WRKBUILD}; ctest -V
|
||||
pre-test:
|
||||
@if pkg_info | grep libconfig- > /dev/null; then \
|
||||
printf "\n*** icinga2 tests do not work if libconfig is installed ***\n\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,53 +1,25 @@
|
||||
$OpenBSD: patch-lib_base_application_cpp,v 1.2 2015/10/20 14:08:57 sthen Exp $
|
||||
$OpenBSD: patch-lib_base_application_cpp,v 1.3 2015/10/21 09:03:22 sthen Exp $
|
||||
|
||||
Revert post-2.2.1 commit which causes hangs at startup on OpenBSD
|
||||
https://github.com/Icinga/icinga2/commit/86819f446e20f6aa0efab45d1e9e7eb87a2bd2b1.patch
|
||||
From e93dd3cf15dab8c63d6510334b1b27b1e208f83a Mon Sep 17 00:00:00 2001
|
||||
From: Gunnar Beutner <gunnar@beutner.name>
|
||||
Date: Wed, 21 Oct 2015 07:02:49 +0200
|
||||
Subject: [PATCH] Ensure that the main thread pool gets re-initialized properly
|
||||
after fork()
|
||||
|
||||
https://dev.icinga.org/issues/10410
|
||||
refs #10410
|
||||
---
|
||||
lib/base/application.cpp | 2 +-
|
||||
lib/base/threadpool.cpp | 12 ++++++++++--
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
--- lib/base/application.cpp.orig Mon Oct 19 10:14:40 2015
|
||||
+++ lib/base/application.cpp Tue Oct 20 14:20:36 2015
|
||||
@@ -117,7 +117,7 @@ void Application::Exit(int rc)
|
||||
logger->Flush();
|
||||
}
|
||||
|
||||
- UninitializeBase();
|
||||
+ Timer::Uninitialize();
|
||||
#ifdef I2_DEBUG
|
||||
exit(rc);
|
||||
#else /* I2_DEBUG */
|
||||
@@ -140,20 +140,8 @@ void Application::InitializeBase(void)
|
||||
#endif /* _WIN32 */
|
||||
|
||||
--- lib/base/application.cpp.orig Wed Oct 21 09:23:05 2015
|
||||
+++ lib/base/application.cpp Wed Oct 21 09:23:28 2015
|
||||
@@ -142,7 +142,7 @@ void Application::InitializeBase(void)
|
||||
Utility::ExecuteDeferredInitializers();
|
||||
-
|
||||
- /* make sure the thread pool gets initialized */
|
||||
|
||||
/* make sure the thread pool gets initialized */
|
||||
- GetTP();
|
||||
-
|
||||
- Timer::Initialize();
|
||||
+ GetTP().Start();
|
||||
|
||||
Timer::Initialize();
|
||||
}
|
||||
|
||||
-void Application::UninitializeBase(void)
|
||||
-{
|
||||
- Timer::Uninitialize();
|
||||
-
|
||||
- GetTP().Stop();
|
||||
-}
|
||||
-
|
||||
/**
|
||||
* Retrieves a pointer to the application singleton object.
|
||||
*
|
||||
@@ -319,7 +307,12 @@ mainloop:
|
||||
DynamicObject::StopObjects();
|
||||
Application::GetInstance()->OnShutdown();
|
||||
|
||||
- UninitializeBase();
|
||||
+#ifdef _DEBUG
|
||||
+ GetTP().Stop();
|
||||
+ m_ShuttingDown = false;
|
||||
+
|
||||
+ Timer::Uninitialize();
|
||||
+#endif /* _DEBUG */
|
||||
}
|
||||
|
||||
void Application::OnShutdown(void)
|
||||
|
@ -1,17 +0,0 @@
|
||||
$OpenBSD: patch-lib_base_application_hpp,v 1.2 2015/10/20 14:08:57 sthen Exp $
|
||||
|
||||
Revert post-2.2.1 commit which causes hangs at startup on OpenBSD
|
||||
https://github.com/Icinga/icinga2/commit/86819f446e20f6aa0efab45d1e9e7eb87a2bd2b1.patch
|
||||
|
||||
https://dev.icinga.org/issues/10410
|
||||
|
||||
--- lib/base/application.hpp.orig Mon Oct 19 10:14:40 2015
|
||||
+++ lib/base/application.hpp Tue Oct 20 14:19:55 2015
|
||||
@@ -44,7 +44,6 @@ class I2_BASE_API Application : public ObjectImpl<Appl
|
||||
~Application(void);
|
||||
|
||||
static void InitializeBase(void);
|
||||
- static void UninitializeBase(void);
|
||||
|
||||
static Application::Ptr GetInstance(void);
|
||||
|
56
net/icinga/core2/patches/patch-lib_base_threadpool_cpp
Normal file
56
net/icinga/core2/patches/patch-lib_base_threadpool_cpp
Normal file
@ -0,0 +1,56 @@
|
||||
$OpenBSD: patch-lib_base_threadpool_cpp,v 1.1 2015/10/21 09:03:22 sthen Exp $
|
||||
|
||||
From e93dd3cf15dab8c63d6510334b1b27b1e208f83a Mon Sep 17 00:00:00 2001
|
||||
From: Gunnar Beutner <gunnar@beutner.name>
|
||||
Date: Wed, 21 Oct 2015 07:02:49 +0200
|
||||
Subject: [PATCH] Ensure that the main thread pool gets re-initialized properly
|
||||
after fork()
|
||||
|
||||
refs #10410
|
||||
---
|
||||
lib/base/application.cpp | 2 +-
|
||||
lib/base/threadpool.cpp | 12 ++++++++++--
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
--- lib/base/threadpool.cpp.orig Mon Oct 19 10:14:40 2015
|
||||
+++ lib/base/threadpool.cpp Wed Oct 21 09:23:30 2015
|
||||
@@ -31,7 +31,7 @@ using namespace icinga;
|
||||
int ThreadPool::m_NextID = 1;
|
||||
|
||||
ThreadPool::ThreadPool(size_t max_threads)
|
||||
- : m_ID(m_NextID++), m_MaxThreads(max_threads), m_Stopped(false)
|
||||
+ : m_ID(m_NextID++), m_MaxThreads(max_threads), m_Stopped(true)
|
||||
{
|
||||
if (m_MaxThreads != UINT_MAX && m_MaxThreads < sizeof(m_Queues) / sizeof(m_Queues[0]))
|
||||
m_MaxThreads = sizeof(m_Queues) / sizeof(m_Queues[0]);
|
||||
@@ -46,6 +46,11 @@ ThreadPool::~ThreadPool(void)
|
||||
|
||||
void ThreadPool::Start(void)
|
||||
{
|
||||
+ if (!m_Stopped)
|
||||
+ return;
|
||||
+
|
||||
+ m_Stopped = false;
|
||||
+
|
||||
for (size_t i = 0; i < sizeof(m_Queues) / sizeof(m_Queues[0]); i++)
|
||||
m_Queues[i].SpawnWorker(m_ThreadGroup);
|
||||
|
||||
@@ -54,6 +59,9 @@ void ThreadPool::Start(void)
|
||||
|
||||
void ThreadPool::Stop(void)
|
||||
{
|
||||
+ if (m_Stopped)
|
||||
+ return;
|
||||
+
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_MgmtMutex);
|
||||
m_Stopped = true;
|
||||
@@ -76,7 +84,7 @@ void ThreadPool::Stop(void)
|
||||
for (size_t i = 0; i < sizeof(m_Queues) / sizeof(m_Queues[0]); i++)
|
||||
m_Queues[i].Stopped = false;
|
||||
|
||||
- m_Stopped = false;
|
||||
+ m_Stopped = true;
|
||||
}
|
||||
|
||||
/**
|
@ -1,31 +0,0 @@
|
||||
$OpenBSD: patch-lib_base_timer_hpp,v 1.2 2015/10/20 14:08:57 sthen Exp $
|
||||
|
||||
Revert post-2.2.1 commit which causes hangs at startup on OpenBSD
|
||||
https://github.com/Icinga/icinga2/commit/86819f446e20f6aa0efab45d1e9e7eb87a2bd2b1.patch
|
||||
|
||||
https://dev.icinga.org/issues/10410
|
||||
|
||||
--- lib/base/timer.hpp.orig Mon Oct 19 10:14:40 2015
|
||||
+++ lib/base/timer.hpp Tue Oct 20 14:19:55 2015
|
||||
@@ -52,6 +52,9 @@ class I2_BASE_API Timer : public Object (public)
|
||||
|
||||
boost::signals2::signal<void(const Timer::Ptr&)> OnTimerExpired;
|
||||
|
||||
+ static void Initialize(void);
|
||||
+ static void Uninitialize(void);
|
||||
+
|
||||
class Holder {
|
||||
public:
|
||||
Holder(Timer *timer)
|
||||
@@ -87,11 +90,6 @@ class I2_BASE_API Timer : public Object (public)
|
||||
void InternalReschedule(bool completed, double next = -1);
|
||||
|
||||
static void TimerThreadProc(void);
|
||||
-
|
||||
- static void Initialize(void);
|
||||
- static void Uninitialize(void);
|
||||
-
|
||||
- friend class Application;
|
||||
};
|
||||
|
||||
}
|
29
net/icinga/core2/patches/patch-lib_cli_daemoncommand_cpp
Normal file
29
net/icinga/core2/patches/patch-lib_cli_daemoncommand_cpp
Normal file
@ -0,0 +1,29 @@
|
||||
$OpenBSD: patch-lib_cli_daemoncommand_cpp,v 1.3 2015/10/21 09:03:22 sthen Exp $
|
||||
|
||||
From 3c6f0e31d9177bf0736ad247df0bb3bf0696e969 Mon Sep 17 00:00:00 2001
|
||||
From: Gunnar Beutner <gunnar@beutner.name>
|
||||
Date: Tue, 20 Oct 2015 22:55:16 +0200
|
||||
Subject: [PATCH] Make sure the timer thread is gone when calling fork()
|
||||
|
||||
refs #10410
|
||||
|
||||
--- lib/cli/daemoncommand.cpp.orig Tue Oct 20 22:13:39 2015
|
||||
+++ lib/cli/daemoncommand.cpp Tue Oct 20 22:14:21 2015
|
||||
@@ -70,7 +70,7 @@ static void SigHupHandler(int)
|
||||
static bool Daemonize(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
- Application::GetTP().Stop();
|
||||
+ Application::UninitializeBase();
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid == -1) {
|
||||
@@ -103,7 +103,7 @@ static bool Daemonize(void)
|
||||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
- Application::GetTP().Start();
|
||||
+ Application::InitializeBase();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
return true;
|
@ -1,23 +0,0 @@
|
||||
$OpenBSD: patch-test_test_cpp,v 1.2 2015/10/20 14:08:57 sthen Exp $
|
||||
|
||||
Revert post-2.2.1 commit which causes hangs at startup on OpenBSD
|
||||
https://github.com/Icinga/icinga2/commit/86819f446e20f6aa0efab45d1e9e7eb87a2bd2b1.patch
|
||||
|
||||
https://dev.icinga.org/issues/10410
|
||||
|
||||
--- test/test.cpp.orig Mon Oct 19 10:14:40 2015
|
||||
+++ test/test.cpp Tue Oct 20 14:19:55 2015
|
||||
@@ -31,11 +31,12 @@ struct InitLibBase
|
||||
InitLibBase(void)
|
||||
{
|
||||
Application::InitializeBase();
|
||||
+ Timer::Initialize();
|
||||
}
|
||||
|
||||
~InitLibBase(void)
|
||||
{
|
||||
- Application::UninitializeBase();
|
||||
+ Timer::Uninitialize();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user