BIND 10 #2974: Implement Hooks Framework (part 1) - all but library loading and unloading (was: Implement Hooks Framework)
BIND 10 Development
do-not-reply at isc.org
Thu May 30 00:06:13 UTC 2013
#2974: Implement Hooks Framework (part 1) - all but library loading and unloading
-------------------------------------+-------------------------------------
Reporter: stephen | Owner:
Type: task | UnAssigned
Priority: medium | Status:
Component: Unclassified | reviewing
Keywords: | Milestone:
Sensitive: 0 | Sprint-DHCP-20130606
Sub-Project: DHCP | Resolution:
Estimated Difficulty: 0 | CVSS Scoring:
Total Hours: 0 | Defect Severity: N/A
| Feature Depending on Ticket:
| Add Hours to Ticket: 0
| Internal?: 0
-------------------------------------+-------------------------------------
Changes (by stephen):
* owner: stephen => UnAssigned
* status: accepted => reviewing
Old description:
> Implement the hooks framework as per the design in
> http://bind10.isc.org/wiki/Bind10HooksFramework
New description:
Implement the hooks framework as per the design in
http://bind10.isc.org/wiki/Bind10HooksFramework.
This ticket only covers the implementation of the data structures for
argument passing, context and calling callouts: it does not cover the
loading and unloading of the libraries.
--
Comment:
Now ready for review, as is the (updated) design on #2938.
One design issue that I came across just before putting this in for review
and on which I would like some feedback concerns the context_create and
context_destroy hooks. These are called to create and destroy per-packet
context. At the moment, the calls are made in the !CalloutHandle's
constructor and destructor respectively. As currently coded, a callout
failure causes an exception to be thrown.
The following issues need to be considered.
1. The current configuration is good in that the server does not need to
worry about calling the creation and destruction callouts. This means
that !CalloutHandles can be created and destroyed without worrying about
not allocating or releasing context. However, if an exception is thrown
in the constructor or destructor, we may end up with a boost::shared_ptr
pointing to a half-created or half-destroyed object. This may be
difficult to recover (as calling a reset() on the shared_ptr will cause it
to try destroying the pointed-to object).
2. We can just ignore failures in the context_create and context_destroy
callouts. This eliminates the problem above, but means that a failure is
difficult to detect and may lead to obscure problems later on.
3. We can call context_create and context_destroy outside the
!CalloutHandle. The former is not a problem - we can have a
!CalloutHandle factory object create the !CalloutHandles in a single place
and call the context_create hook right after creation. The latter is more
an issue - if the !CalloutHandle is destroyed in multiple places (possibly
by the last shared_ptr to it being reset), the context_destroy callback
may not get called and we have a resource leak.
--
Ticket URL: <http://bind10.isc.org/ticket/2974#comment:2>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list