Fix deadlock in RemoteStore::queryPathInfoUncached()

This commit is contained in:
Eelco Dolstra 2018-04-09 21:26:16 +02:00
parent 7d21863bb3
commit a4c1618876
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -297,6 +297,8 @@ void RemoteStore::queryPathInfoUncached(const Path & path,
Callback<std::shared_ptr<ValidPathInfo>> callback) Callback<std::shared_ptr<ValidPathInfo>> callback)
{ {
try { try {
std::shared_ptr<ValidPathInfo> info;
{
auto conn(connections->get()); auto conn(connections->get());
conn->to << wopQueryPathInfo << path; conn->to << wopQueryPathInfo << path;
try { try {
@ -311,7 +313,7 @@ void RemoteStore::queryPathInfoUncached(const Path & path,
bool valid; conn->from >> valid; bool valid; conn->from >> valid;
if (!valid) throw InvalidPath(format("path '%s' is not valid") % path); if (!valid) throw InvalidPath(format("path '%s' is not valid") % path);
} }
auto info = std::make_shared<ValidPathInfo>(); info = std::make_shared<ValidPathInfo>();
info->path = path; info->path = path;
info->deriver = readString(conn->from); info->deriver = readString(conn->from);
if (info->deriver != "") assertStorePath(info->deriver); if (info->deriver != "") assertStorePath(info->deriver);
@ -323,6 +325,7 @@ void RemoteStore::queryPathInfoUncached(const Path & path,
info->sigs = readStrings<StringSet>(conn->from); info->sigs = readStrings<StringSet>(conn->from);
conn->from >> info->ca; conn->from >> info->ca;
} }
}
callback(std::move(info)); callback(std::move(info));
} catch (...) { callback.rethrow(); } } catch (...) { callback.rethrow(); }
} }