From: Vladimír Čunát Date: Tue, 12 Dec 2023 09:32:30 +0000 (+0100) Subject: daemon/io: close LMDB txns after control socket commands X-Git-Tag: v6.0.5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fenvironments%2Fdocs-develop-6-0-mvwoqi%2Fdeployments%2F2931;p=thirdparty%2Fknot-resolver.git daemon/io: close LMDB txns after control socket commands There's the issue that during config-file loading we prefer to do all changes in rule DB inside a single transaction, so the normal commands do not close them. However with control socket commands we can't afford to leave transactions open (unclear for how long), especially RW transactions. --- diff --git a/daemon/io.c b/daemon/io.c index c077d91bb..d54019d2a 100644 --- a/daemon/io.c +++ b/daemon/io.c @@ -806,6 +806,10 @@ finish: if (stream_fd != STDIN_FILENO) { fclose(out); } + /* If a LMDB transaction got open, we can't leave it hanging. + * We accept the changes, if any. */ + kr_cache_commit(&the_resolver->cache); + kr_rules_commit(true); } void io_tty_alloc(uv_handle_t *handle, size_t suggested, uv_buf_t *buf)