]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/io: close LMDB txns after control socket commands docs-develop-6-0-mvwoqi/deployments/2931
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 12 Dec 2023 09:32:30 +0000 (10:32 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 13 Dec 2023 07:02:00 +0000 (08:02 +0100)
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.

daemon/io.c

index c077d91bb6ae9e0296319b58079d1061c0ec81de..d54019d2a3b8fdb948e40f704176c5a530f3e27e 100644 (file)
@@ -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)