PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.7k stars 908 forks source link

dnsdist loses remote logger thread on daemonizing (-d) #6329

Closed jpmens closed 6 years ago

jpmens commented 6 years ago

Short description

When starting dnsdist with -d (--daemonize), the program doesn't log to a remote logger. It's as though this action were never specified, though the connect is seen:

addAction(AllRule(), RemoteLogAction(newRemoteLogger("10.0.0.1:4242", 2, 2)))

In a private conversation with @rgacogne it turns out that:

we call daemonize() after creating the remote logger thread daemonize() calls fork() and the parent process exits so there is no remote logger worker thread anymore

For the record, Remi also says

same pain for TeeAction and, obviously, dnstap

Environment

Expected behaviour

Logging should occur as without daemonize

jpmens commented 6 years ago

It has been brought to my attention that using --daemonize can almost be considered stupid because systemd et.al. exist, so why would I do this? I did this because systemd (though available on the platform I'm working on) isn't used here for launching "applications" such as dnsdist. Having found dnsdist has an option to daemonize I thought I'd use it. That might have been a mistake.

After a bit of consideration, I think the option/code for --daemonize should be removed and be done with it.

Habbie commented 6 years ago

After a bit of consideration, I think the option/code for --daemonize should be removed and be done with it.

Yes.