Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Kea Kea
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 557
    • Issues 557
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 59
    • Merge requests 59
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • KeaKea
  • Issues
  • #571
Closed
Open
Issue created Apr 16, 2019 by Marcin Siodelski@marcinDeveloper

Segfault when DHCP server using CB terminates (clang only)

When running some manual tests of the CB on macOS I noticed that it causes a segfault upon termination. This doesn't impact the operation of the DHCP server. It occurs when the process exits and destructor of the CfgMgr is invoked. The snippet https://gitlab.isc.org/snippets/840 includes a back trace. This issue only occurs when Kea is compiled with clang.

The direct cause of this issue is that we allocate objects such as subnets, shared networks etc. within the heap that belongs to the dynamically loaded library (hooks library) and then pass them back to the binary (Kea server). As long as the library is loaded the Kea server can safely use those objects. However, when the library is unloaded the memory space dedicated for the library is gone and no longer accessible by the binary. As a result, the binary segfaults when trying to destroy the object.

One of the considered solutions was to make the library clear the configuration when it is being unloaded. I tried that and it indeed prevented the crash. However, we want the configuration to outlive the library. Especially that there is no easy way to clear the configuration that was introduced by the library and preserve all the rest.

The better solution which I tested was to create the static factory functions within Kea, e.g. Subnet4::create which would return the shared pointer to the newly created object. The library must call this factory function (rather than create the instance on its own) which will cause the instance to be created by the binary, rather than the library. That way, when the library is unloaded the object is still available.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking