Tomas Krizek [Fri, 2 Jul 2021 08:48:32 +0000 (10:48 +0200)]
daemon/worker: ensure HTTP headers are freed on ignored queries
Ignored queries never call create_request() where ownership of headers
is taken care of. They need to be explicitly cleared instead, because
we're the owners of the pointer here.
Vladimír Čunát [Tue, 13 Jul 2021 11:05:40 +0000 (13:05 +0200)]
treewide: replace VERBOSE_STATUS, WITH_VERBOSE, etc.
The main problem there was ignoring the log groups,
and VERBOSE_STATUS also ignores trace-logging.
Typically the new kr_log_is_debug*() are the best choice.
In a couple places with heavy WITH_VERBOSE usage it's
instead locally redefined to consider the right group.
Vladimír Čunát [Tue, 13 Jul 2021 10:06:28 +0000 (12:06 +0200)]
validate: add kr_rrset_validation_ctx_t::log_qry
... so we can use it for more precise logging. Some calls get simpler.
In particular, without the associated request, we can't produce anything
into trace-logs, which could be confusing. Normal logs will benefit, too.
(more precise replacement of WITH_VERBOSE will come in a subsequent commit)
Vladimír Čunát [Mon, 12 Jul 2021 18:02:12 +0000 (20:02 +0200)]
rework logging from control sockets (+simplify)
- unify interactive mode to stdout
- use its own logging group
- elevated log level when the command throws an exception
- don't try detecting that the logs go back into the same console
(yes, in that case you can see some lines twice)
- don't make the binary mode turn off logging
Vladimír Čunát [Mon, 12 Jul 2021 20:00:15 +0000 (22:00 +0200)]
QRVERBOSE: fix ignoring the log groups
It would be yet another condition to check; overall I think the
necessary checks would get too complex to be done in a macro
and therefore copied all over the place.
Note: it's interesting that such a change reduces binary size
by about 3% (on master), and I suspect that speed won't suffer at all
(after that TODO is done).
Vladimír Čunát [Mon, 12 Jul 2021 09:27:17 +0000 (11:27 +0200)]
lib/log: typing improvements
- const for names of log groups
- enum kr_log_group for a single log group
- the kr_log_groups bitmap doesn't need to be exposed or even exported
- return bool instead of int
Tomas Krizek [Thu, 8 Jul 2021 15:07:10 +0000 (17:07 +0200)]
logging: use LOG_GRP_HTTP for http lua module
It's better to use separate log group, to separate between logs that
come from the lua module vs native C implementation. It is also more
descriptive, since http modules is used for other stuff besides its
deprecated DoH.
Tomas Krizek [Thu, 8 Jul 2021 11:28:11 +0000 (13:28 +0200)]
logging: add LOG_GRP_DEVEL
This serves two purposes:
1. As a utility logger during development.
2. As the last entry in enum - to make iteration over the values
possible. Changing the value of LOG_GRP_DEVEL shouldn't be an issue,
since it shouldn't be used in production code.
Tomas Krizek [Wed, 7 Jul 2021 15:15:08 +0000 (17:15 +0200)]
logging: add get_log_group() with better API
The function returns a table where key is the group name and the value
is either true (when logging selected group), or nil (when group isn't
selected).
This replaces the list_log_group() which didn't really work.
Vladimír Čunát [Fri, 21 May 2021 15:29:25 +0000 (17:29 +0200)]
lib/selection: be more careful with RO transactions
They probably couldn't hang open for long, as each client request
should cause some cache-searching and thus close it, and even with
queries stopping I haven't managed to find a case where it would be
left open but... it's nicer to clean up and it should be very cheap.
Vladimír Čunát [Tue, 1 Jun 2021 14:26:04 +0000 (16:26 +0200)]
daemon/worker: fix a memory leak
Discovered case: TCP write towards upstream fails due to ECONNRESET,
and on this place of code we "forget" the whole qr_task and thus its
corresponding kr_request, so it remains unanswered and using memory.
Tomas Krizek [Thu, 27 May 2021 13:20:53 +0000 (15:20 +0200)]
rename kind="doh" to kind="doh_legacy"
The purpose of this change is to make it harder to accidentally use the
legacy DoH implementation and free up the "doh" kind which may be used
as an alias to a modern implementation in the future.