Skip to content

Commit

Permalink
withFramedSink(): Receive interrupts on the stderr thread
Browse files Browse the repository at this point in the history
Otherwise Nix deadlocks when Ctrl-C is received in withFramedSink():
the parent thread will wait forever for the stderr thread to shut
down.

Fixes the hang reported in #7245 (comment).

(cherry picked from commit 24e7048)
  • Loading branch information
edolstra authored and github-actions[bot] committed Jan 4, 2024
1 parent b38e5a6 commit 4b38ebb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libstore/remote-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "logging.hh"
#include "callback.hh"
#include "filetransfer.hh"
#include "signals.hh"

#include <nlohmann/json.hpp>

namespace nix {
Expand Down Expand Up @@ -1071,6 +1073,7 @@ void RemoteStore::ConnectionHandle::withFramedSink(std::function<void(Sink & sin
std::thread stderrThread([&]()
{
try {
ReceiveInterrupts receiveInterrupts;
processStderr(nullptr, nullptr, false);
} catch (...) {
ex = std::current_exception();
Expand Down

0 comments on commit 4b38ebb

Please sign in to comment.