mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Merge pull request #11665 from roberth/fix-Interrupted-falling-out-of-thread
Fix `Interrupted` falling out of thread crash
This commit is contained in:
commit
f51974d698
3 changed files with 18 additions and 3 deletions
|
@ -65,6 +65,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "strings.hh"
|
||||
#include "signals.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
@ -1579,6 +1580,8 @@ void LocalDerivationGoal::startDaemon()
|
|||
FdSink(remote.get()),
|
||||
NotTrusted, daemon::Recursive);
|
||||
debug("terminated daemon connection");
|
||||
} catch (const Interrupted &) {
|
||||
debug("interrupted daemon connection");
|
||||
} catch (SystemError &) {
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
|
|
|
@ -225,8 +225,15 @@ struct LocalDerivationGoal : public DerivationGoal
|
|||
*/
|
||||
void writeStructuredAttrs();
|
||||
|
||||
/**
|
||||
* Start an in-process nix daemon thread for recursive-nix.
|
||||
*/
|
||||
void startDaemon();
|
||||
|
||||
/**
|
||||
* Stop the in-process nix daemon thread.
|
||||
* @see startDaemon
|
||||
*/
|
||||
void stopDaemon();
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,10 +110,15 @@ void ThreadPool::doWork(bool mainThread)
|
|||
propagate it. */
|
||||
try {
|
||||
std::rethrow_exception(exc);
|
||||
} catch (const Interrupted &) {
|
||||
// The interrupted state may be picked up by multiple
|
||||
// workers, which is expected, so we should ignore
|
||||
// it silently and let the first one bubble up,
|
||||
// rethrown via the original state->exception.
|
||||
} catch (const ThreadPoolShutDown &) {
|
||||
// Similarly expected.
|
||||
} catch (std::exception & e) {
|
||||
if (!dynamic_cast<ThreadPoolShutDown*>(&e))
|
||||
ignoreExceptionExceptInterrupt();
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue