Skip to content

Commit 788e3f7

Browse files
committed
query: increase logs to find deadlock issue.
1 parent 42a196f commit 788e3f7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

query/worker.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package query
22

33
import (
44
"errors"
5+
"fmt"
56
"time"
67

78
"github.com/btcsuite/btcd/wire"
@@ -43,6 +44,12 @@ func (q *queryJob) Index() uint64 {
4344
return q.index
4445
}
4546

47+
// String returns the string representation of the queryJob code.
48+
func (q *queryJob) String() string {
49+
return fmt.Sprintf("QueryJob(index=%v): tries=%v, timeout=%v, +"+
50+
"request_msg: %v", q.index, q.tries, q.timeout, q.Req)
51+
}
52+
4653
// jobResult is the final result of the worker's handling of the queryJob.
4754
type jobResult struct {
4855
job *queryJob

query/workmanager.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ Loop:
308308
delete(currentQueries, result.job.index)
309309
batch := currentBatches[batchNum]
310310

311+
log.Debugf("Job(%v) received a result=%v, "+
312+
"batchNum=%v, batch=%v, pendingQueries=%v, "+
313+
"pendingBatches=%v", result.job, result,
314+
batchNum, batch, len(currentQueries),
315+
len(currentBatches))
316+
317+
log.Debugf("Batch info: %v,%v,%v", batch.maxRetries,
318+
batch.timeout, batch.noRetryMax)
319+
311320
switch {
312321
// If the query ended because it was canceled, drop it.
313322
case result.err == ErrJobCanceled:
@@ -434,6 +443,12 @@ Loop:
434443
log.Debugf("Adding new batch(%d) of %d queries to "+
435444
"work queue", batchIndex, len(batch.requests))
436445

446+
log.Debugf("Current queries to manage %d: %v",
447+
len(currentQueries), currentQueries)
448+
449+
log.Debugf("Current batches to manage %d: %v",
450+
len(currentBatches), currentBatches)
451+
437452
for _, q := range batch.requests {
438453
heap.Push(work, &queryJob{
439454
index: queryIndex,

0 commit comments

Comments
 (0)