Fix deadlock in RemoteStore::queryPathInfoUncached()
This commit is contained in:
		
							parent
							
								
									7d21863bb3
								
							
						
					
					
						commit
						a4c1618876
					
				
					 1 changed files with 28 additions and 25 deletions
				
			
		| 
						 | 
					@ -297,31 +297,34 @@ void RemoteStore::queryPathInfoUncached(const Path & path,
 | 
				
			||||||
    Callback<std::shared_ptr<ValidPathInfo>> callback)
 | 
					    Callback<std::shared_ptr<ValidPathInfo>> callback)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        auto conn(connections->get());
 | 
					        std::shared_ptr<ValidPathInfo> info;
 | 
				
			||||||
        conn->to << wopQueryPathInfo << path;
 | 
					        {
 | 
				
			||||||
        try {
 | 
					            auto conn(connections->get());
 | 
				
			||||||
            conn->processStderr();
 | 
					            conn->to << wopQueryPathInfo << path;
 | 
				
			||||||
        } catch (Error & e) {
 | 
					            try {
 | 
				
			||||||
            // Ugly backwards compatibility hack.
 | 
					                conn->processStderr();
 | 
				
			||||||
            if (e.msg().find("is not valid") != std::string::npos)
 | 
					            } catch (Error & e) {
 | 
				
			||||||
                throw InvalidPath(e.what());
 | 
					                // Ugly backwards compatibility hack.
 | 
				
			||||||
            throw;
 | 
					                if (e.msg().find("is not valid") != std::string::npos)
 | 
				
			||||||
        }
 | 
					                    throw InvalidPath(e.what());
 | 
				
			||||||
        if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 17) {
 | 
					                throw;
 | 
				
			||||||
            bool valid; conn->from >> valid;
 | 
					            }
 | 
				
			||||||
            if (!valid) throw InvalidPath(format("path '%s' is not valid") % path);
 | 
					            if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 17) {
 | 
				
			||||||
        }
 | 
					                bool valid; conn->from >> valid;
 | 
				
			||||||
        auto info = std::make_shared<ValidPathInfo>();
 | 
					                if (!valid) throw InvalidPath(format("path '%s' is not valid") % path);
 | 
				
			||||||
        info->path = path;
 | 
					            }
 | 
				
			||||||
        info->deriver = readString(conn->from);
 | 
					            info = std::make_shared<ValidPathInfo>();
 | 
				
			||||||
        if (info->deriver != "") assertStorePath(info->deriver);
 | 
					            info->path = path;
 | 
				
			||||||
        info->narHash = Hash(readString(conn->from), htSHA256);
 | 
					            info->deriver = readString(conn->from);
 | 
				
			||||||
        info->references = readStorePaths<PathSet>(*this, conn->from);
 | 
					            if (info->deriver != "") assertStorePath(info->deriver);
 | 
				
			||||||
        conn->from >> info->registrationTime >> info->narSize;
 | 
					            info->narHash = Hash(readString(conn->from), htSHA256);
 | 
				
			||||||
        if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
 | 
					            info->references = readStorePaths<PathSet>(*this, conn->from);
 | 
				
			||||||
            conn->from >> info->ultimate;
 | 
					            conn->from >> info->registrationTime >> info->narSize;
 | 
				
			||||||
            info->sigs = readStrings<StringSet>(conn->from);
 | 
					            if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
 | 
				
			||||||
            conn->from >> info->ca;
 | 
					                conn->from >> info->ultimate;
 | 
				
			||||||
 | 
					                info->sigs = readStrings<StringSet>(conn->from);
 | 
				
			||||||
 | 
					                conn->from >> info->ca;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        callback(std::move(info));
 | 
					        callback(std::move(info));
 | 
				
			||||||
    } catch (...) { callback.rethrow(); }
 | 
					    } catch (...) { callback.rethrow(); }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue