From 746b11bce84bf8ba0bc6edcc2755d2122d9806a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 12 Dec 2023 10:32:30 +0100 Subject: [PATCH] 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. --- daemon/io.c | 4 ++++ 1 file changed, 4 insertions(+) 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) -- 2.47.2