[kea-dev] [PATCH] [master] Fix: Release the reference of hook library

Tomek Mrugalski tomasz at isc.org
Thu Mar 8 07:51:35 UTC 2018


Hi,

I was going through old mails and it seems nobody responded this.

Thanks for reporting the issue and for sending the patch. I've created
#5564 to deal with this problem (http://kea.isc.org/ticket/5564).

Tomek

On 11/12/2017 03:50, Yahu Gao wrote:
> 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
> 


More information about the kea-dev mailing list