dht: add in code to detect and diagnose #3032
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Aug 3, 2016 at 18:19 UTC
ce6782a22db8ad038c56b9534d9e1377871cb3b2
1 file changed
+11
routing/dht/routing.go
+11
@@ -3,6 +3,7 @@ package dht
3
import (
4
"bytes"
5
"fmt"
6
+ "runtime"
7
"sync"
8
"time"
9
@@ -380,6 +381,16 @@ func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key key.Key,
381
_, err := query.Run(ctx, peers)
382
if err != nil {
383
log.Debugf("Query error: %s", err)
384
+ // Special handling for issue: https://github.com/ipfs/go-ipfs/issues/3032
385
+ if fmt.Sprint(err) == "<nil>" {
386
+ log.Error("reproduced bug 3032:")
387
+ log.Errorf("Errors type information: %#v", err)
388
+ log.Errorf("go version: %s", runtime.Version())
389
+ log.Error("please report this information to: https://github.com/ipfs/go-ipfs/issues/3032")
390
+
391
+ // replace problematic error with something that won't crash the daemon
392
+ err = fmt.Errorf("<nil>")
393
+ }
394
notif.PublishQueryEvent(ctx, ¬if.QueryEvent{
395
Type: notif.QueryError,
396
Extra: err.Error(),