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).
  • Loading branch information
edolstra committed Jan 3, 2024
1 parent 315aade commit 24e7048
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 @@ -1066,6 +1068,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 24e7048

Please sign in to comment.