[Pdns-users] [Pdns-dev] Question regarding life time of backend threads in PDNS
cmouse at youzen.ext.b2.fi
Fri Nov 8 07:33:22 UTC 2013
On Fri, Nov 08, 2013 at 07:22:40AM +0000, Seema Datar wrote:
> Hi All,
> Does anybody have more information on this?
> Hi All,
> We have a use case where we use PDNS with 8 backend threads. We needed to save thread specific data in an mmap. However, I came across the following in PDNS documentation -
> PowerDNS may instantiate multiple instances of your backend, or destroy existing copies and instantiate new ones. Backend code should therefore be thread-safe with respect to its static data. Additionally, it is wise if instantiation is a fast operation, with the possible exception of the first construction.
> The questions I had are -
> 1. What is the lifetime of a backend thread?
> 2. How often does a thread get destroyed and a new thread get created?
> 3. Is there any interface available to do a cleanup before the thread ends?
Lifetime of a backend thread is dependant on several factors, and the only
thing you can assume is that it's not something you can rely on.
The only thing backend module can use for cleanup is the destructror of the
Or if you use remote/pipebackend, you can wire it to look for EOF or signal
and cleanup when either one is received before dying out.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: Digital signature
More information about the Pdns-users