aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-09-22 15:28:20 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-09-22 15:28:20 +0200
commit980edd1f3a31eefe297d073f6a7cff099f21eb4a (patch)
tree0df446e2b6e010b385fba1b315af659c7031e380 /src/libstore
parent5b107f2c5f5bb86042f9f65b022cf0ed0bfaccbd (diff)
RemoteStore::addCAToStore(): Don't hold connection while calling queryPathInfo()
This leads to a deadlock if we're at the connection limit.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/remote-store.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 6f1f9769b..be5eb4736 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -541,7 +541,8 @@ ref<const ValidPathInfo> RemoteStore::addCAToStore(
const StorePathSet & references,
RepairFlag repair)
{
- auto conn(getConnection());
+ std::optional<ConnectionHandle> conn_(getConnection());
+ auto & conn = *conn_;
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 25) {
@@ -605,6 +606,8 @@ ref<const ValidPathInfo> RemoteStore::addCAToStore(
}
}, caMethod);
auto path = parseStorePath(readString(conn->from));
+ // Release our connection to prevent a deadlock in queryPathInfo().
+ conn_.reset();
return queryPathInfo(path);
}
}