[kea-dev] [PATCH] [master] Fix: Release the reference of hook library
Yahu Gao
yahu.gao at windriver.com
Mon Dec 11 02:50:20 UTC 2017
Problem: Kea unload the hook library when handing the first incoming
message after reload by using command "keactrl reload -c configfile".
This cause hook library function cannot be called and message handling
stop.
Reason: Kea hold the hook library reference by using shared_ptr in
several place. Hook library is not correctly released when reload the
kea, But released when handing the first incoming message.
Fix: Release the reference of hook library in correct place when reload
the kea. After reload the hook library, shared_ptr hold the correct
reference to it.
Signed-off-by: Anders Wallin <anders.wallin at windriver.com>
Signed-off-by: Yahu Gao <yahu.gao at windriver.com>
---
src/lib/hooks/hooks_manager.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/lib/hooks/hooks_manager.cc b/src/lib/hooks/hooks_manager.cc
index b4702ba..73ee637 100644
--- a/src/lib/hooks/hooks_manager.cc
+++ b/src/lib/hooks/hooks_manager.cc
@@ -12,6 +12,9 @@
#include <hooks/hooks_manager.h>
#include <hooks/server_hooks.h>
+#include <dhcp/pkt6.h>
+#include <dhcpsrv/callout_handle_store.h>
+
#include <boost/shared_ptr.hpp>
#include <string>
@@ -121,6 +124,10 @@ HooksManager::loadLibraries(const HookLibsCollection& libraries) {
void
HooksManager::unloadLibrariesInternal() {
+ // Clean callout_handle_store for static CalloutHandlePtr.
+ // fix the Kea reload cause the hook library unload.
+ isc::dhcp::Pkt6Ptr pkt6ptr_empty;
+ isc::dhcp::getCalloutHandle(pkt6ptr_empty);
// The order of deletion does not matter here, as each library manager
// holds its own pointer to the callout manager. However, we may as
// well delete the library managers first: if there are no other references
--
1.8.3.1
More information about the kea-dev
mailing list