Skip to content

Commit 051b500

Browse files
committed
Fix Disconnect Deadlock
It only happened when very precise conditions are met, but often enough to affect some miners. I was able to reproduce the conditions and don't get deadlocks anymore. Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
1 parent e511c3c commit 051b500

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Miner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,10 @@ void Miner::_manageTasks() {
12561256
int nRemainingSieves(_parameters.sieveWorkers);
12571257
while (nRemainingAdditionalPresieveTasks > 0) {
12581258
const TaskDoneInfo taskDoneInfo(_tasksDoneInfos.blocking_pop_front());
1259-
if (!_running) return;
1259+
if (!_running) {
1260+
for (auto &sieve : _sieves) sieve.presieveLock.unlock();
1261+
return;
1262+
}
12601263
if (taskDoneInfo.type == Task::Type::Presieve) nRemainingAdditionalPresieveTasks--;
12611264
else if (taskDoneInfo.type == Task::Type::Sieve) nRemainingSieves--;
12621265
else _works[taskDoneInfo.workIndex].nRemainingCheckTasks--;

0 commit comments

Comments
 (0)