-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Tools and Replicator
-
114
Problem Statement/Rationale
TOOLS-2722 introduced this change:
diff --git a/common/db/db.go b/common/db/db.go
index 969ddebf..1d7a4f1a 100644
--- a/common/db/db.go
+++ b/common/db/db.go
@@ -128,7 +128,7 @@ func NewSessionProvider(opts options.ToolOptions) (*SessionP
rovider, error) {
}
err = client.Ping(context.Background(), nil)
if err != nil {
- return nil, fmt.Errorf("could not connect to server: %v", err)
+ return nil, fmt.Errorf("failed to connect to %s: %v", opts.URI.P
arsedConnString(), err)
}
// create the provider
… which is causing a segfault in a test in an internal fork of mongomirror. The test passes a ToolOptions whose URI is nil, which causes a nil dereference error.
Steps to Reproduce
Not sure … this may not actually happen in production.
Expected Results
We should see the error that NewSessionProvider() wants to return.
Actual Results
segfault (in mongomirror test):
--- FAIL: TestFailToConnectToSource (30.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1049cd594]
goroutine 193 [running]:
testing.tRunner.func1.2({0x104e73820, 0x105587a60})
/usr/local/go/src/testing/testing.go:1734 +0x2bc
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1737 +0x47c
panic({0x104e73820?, 0x105587a60?})
/usr/local/go/src/runtime/panic.go:792 +0x124
github.com/mongodb/mongo-tools/common/db.NewSessionProvider({{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, 0x0, 0x0, 0xc00029a4e0, 0xc00029c9b0, ...})
/Users/felipe/go/src/github.com/10gen/custom-mongomirror/vendor/github.com/mongodb/mongo-tools/common/db/db.go:126 +0x114
github.com/10gen/mongomirror/mongomirror.(*MongoMirror).Init(0xc000644008)
/Users/felipe/go/src/github.com/10gen/custom-mongomirror/mongomirror/mongomirror.go:1141 +0xdac
github.com/10gen/mongomirror/mongomirror.TestFailToConnectToSource(0xc000297500)
/Users/felipe/go/src/github.com/10gen/custom-mongomirror/mongomirror/mongomirror_internal_test.go:4985 +0x118
testing.tRunner(0xc000297500, 0x104f76600)
/usr/local/go/src/testing/testing.go:1792 +0x184
created by testing.(*T).Run in goroutine 1
/usr/local/go/src/testing/testing.go:1851 +0x688
exit status 2
FAIL github.com/10gen/mongomirror/mongomirror 48.317s
+ cd ..
+ '[' true = true ']'
+ mongo-orchestration stop
+ '[' -f server.pid ']'
+ exit 1
- is caused by
-
TOOLS-2722 Add MacOS 11.0 ARM to Tools
-
- Closed
-