Skip to content

Commit

Permalink
Only restart threads that are not stuck waiting on lp staged work, an…
Browse files Browse the repository at this point in the history
…d add one mandatory queued work item for each restart.
  • Loading branch information
ckolivas committed Jul 14, 2011
1 parent 7e38a37 commit ba4ba7f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,8 +1924,16 @@ static void *watchdog_thread(void *userdata)
for (i = 0; i < mining_threads; i++) {
struct thr_info *thr = &thr_info[i];

if (now.tv_sec - thr->last.tv_sec > 60) {
/* Do not kill threads waiting on longpoll staged work */
if (now.tv_sec - thr->last.tv_sec > 60 && !lp_staged) {
applog(LOG_ERR, "Attempting to restart thread %d, idle for more than 60 seconds", i);
/* Create one mandatory work item */
inc_staged(1, true);
if (unlikely(!queue_request())) {
applog(LOG_ERR, "Failed to queue_request in watchdog_thread");
kill_work();
break;
}
reinit_thread(i);
applog(LOG_WARNING, "Thread %d restarted", i);
}
Expand Down

0 comments on commit ba4ba7f

Please sign in to comment.