Closed ajres closed 7 years ago
When running SG unit tests with Golang 1.8, multiple tests panic.
Here are two examples:
=== RUN TestSkippedViewRetrieval 2017-03-29T13:23:14.417+01:00 Opening Walrus database sync_gateway_tests on <walrus:> 2017-03-29T13:23:14.418+01:00 Cache: Initializing changes cache with options {ChannelCacheOptions:{ChannelCacheMinLength:0 ChannelCacheMaxLength:0 ChannelCacheAge:0s} CachePendingSeqMaxWait:5ms CachePendingSeqMaxNum:50 CacheSkippedSeqMaxWait:2m0s} 2017-03-29T13:23:14.428+01:00 Cache: Querying 'channels' view for "*" (start=#3, end=#3, limit=0) 2017-03-29T13:23:14.429+01:00 Cache: Received #1 after 0ms ("doc-1" / "1-a") 2017-03-29T13:23:14.429+01:00 Cache: Received #2 after 0ms ("doc-2" / "1-a") 2017-03-29T13:23:14.429+01:00 Cache: Initialized cache for channel "ABC" with options: &{ChannelCacheMinLength:50 ChannelCacheMaxLength:500 ChannelCacheAge:1m0s} 2017-03-29T13:23:14.429+01:00 Cache: #1 ==> channel "ABC" 2017-03-29T13:23:14.429+01:00 Cache: Initialized cache for channel "*" with options: &{ChannelCacheMinLength:50 ChannelCacheMaxLength:500 ChannelCacheAge:1m0s} 2017-03-29T13:23:14.429+01:00 Cache: #1 ==> channel "*" 2017-03-29T13:23:14.429+01:00 Cache: #2 ==> channel "ABC" 2017-03-29T13:23:14.429+01:00 Cache: #2 ==> channel "*" --- FAIL: TestSkippedViewRetrieval (0.02s) 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=0x1 addr=0x48 pc=0x4379586] goroutine 160 [running]: testing.tRunner.func1(0xc4202b65b0) /usr/local/go/src/testing/testing.go:621 +0x29b panic(0x4683b20, 0x4c13020) /usr/local/go/src/runtime/panic.go:489 +0x2cf golang.org/x/text/collate.newCollator(0x0, 0x0, 0x0) /Users/andy/projects/sync_gateway/godeps/src/golang.org/x/text/collate/option.go:32 +0x146 golang.org/x/text/collate.New(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc420052d68) /Users/andy/projects/sync_gateway/godeps/src/golang.org/x/text/collate/collate.go:50 +0x104 github.com/couchbase/sg-bucket.(*JSONCollator).compareStrings(0xc4201babb8, 0xc42063e020, 0x3, 0xc42059db47, 0x1, 0xc420052e38) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/collate.go:101 +0xc7 github.com/couchbase/sg-bucket.(*JSONCollator).Collate(0xc4201babb8, 0x464a840, 0xc42063e2f0, 0x464a840, 0xc42063e220, 0x4d72c20) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/collate.go:57 +0x217 github.com/couchbase/sg-bucket.(*JSONCollator).Collate(0xc4201babb8, 0x463ecc0, 0xc4205c0d60, 0x463ecc0, 0xc4205c0960, 0xa) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/collate.go:65 +0x325 github.com/couchbase/sg-bucket.(*ViewResult).Less(0xc4201bab80, 0x1, 0x0, 0x473dc01) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/views.go:220 +0x7b sort.insertionSort(0x4aabc60, 0xc4201bab80, 0x0, 0x6) /usr/local/go/src/sort/sort.go:29 +0x71 sort.quickSort(0x4aabc60, 0xc4201bab80, 0x0, 0x6, 0x6) /usr/local/go/src/sort/sort.go:211 +0x1eb sort.Sort(0x4aabc60, 0xc4201bab80) /usr/local/go/src/sort/sort.go:220 +0x79 github.com/couchbaselabs/walrus.(*lolrus).updateView(0xc4205b4120, 0xc4204fff80, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbaselabs/walrus/views.go:256 +0x7e8 github.com/couchbaselabs/walrus.(*lolrus).View(0xc4205b4120, 0x473f5d9, 0xc, 0x473bc88, 0x8, 0xc42032a210, 0x0, 0x0, 0x0, 0x0, ...) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbaselabs/walrus/views.go:151 +0x30f github.com/couchbaselabs/walrus.(*lolrus).ViewCustom(0xc4205b4120, 0x473f5d9, 0xc, 0x473bc88, 0x8, 0xc42032a210, 0x462a800, 0xc4201bab40, 0xc420224801, 0xc4201bab40) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbaselabs/walrus/views.go:265 +0x84 github.com/couchbase/sync_gateway/base.(*LeakyBucket).ViewCustom(0xc42007db40, 0x473f5d9, 0xc, 0x473bc88, 0x8, 0xc42032a210, 0x462a800, 0xc4201bab40, 0xa6, 0xab) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/base/leaky_bucket.go:113 +0x8c github.com/couchbase/sync_gateway/db.(*DatabaseContext).getChangesInChannelFromView(0xc42038c6c0, 0x4735f61, 0x1, 0x3, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, ...) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/db/changes_view.go:40 +0x7c1 github.com/couchbase/sync_gateway/db.(*changeCache).CleanSkippedSequenceQueue.func1(0xc4204a03c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/db/change_cache.go:213 +0x210 github.com/couchbase/sync_gateway/db.(*changeCache).CleanSkippedSequenceQueue(0xc4204a03c0, 0xc4200880f0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/db/change_cache.go:232 +0x40 github.com/couchbase/sync_gateway/db.TestSkippedViewRetrieval(0xc4202b65b0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/db/change_cache_test.go:811 +0x644 testing.tRunner(0xc4202b65b0, 0x4765880) /usr/local/go/src/testing/testing.go:656 +0x93 created by testing.(*T).Run /usr/local/go/src/testing/testing.go:693 +0x2c4 FAIL github.com/couchbase/sync_gateway/db 2.946s
=== RUN TestUserAPI 2017-03-29T13:23:12.831+01:00 Opening db /db as bucket "sync_gateway_test_0", pool "default", server <walrus:> 2017-03-29T13:23:12.831+01:00 Opening Walrus database sync_gateway_test_0 on <walrus:> 2017-03-29T13:23:12.832+01:00 Using default sync function 'channel(doc.channels)' for database "db" 2017-03-29T13:23:12.833+01:00 WARNING: No users have been defined in the 'db' database, which means that you will not be able to get useful data out of the sync gateway over the standard port. FIX: define users in the configuration json or via the REST API on the admin port, and grant users to channels via the admin_channels parameter. -- rest.emitAccessRelatedWarnings() at server_context.go:899 --- FAIL: TestUserAPI (0.09s) 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=0x1 addr=0x48 pc=0x43d7b36] goroutine 19 [running]: testing.tRunner.func1(0xc420146dd0) /usr/local/go/src/testing/testing.go:621 +0x29b panic(0x47590a0, 0x4d82dd0) /usr/local/go/src/runtime/panic.go:489 +0x2cf golang.org/x/text/collate.newCollator(0x0, 0x0, 0x0) /Users/andy/projects/sync_gateway/godeps/src/golang.org/x/text/collate/option.go:32 +0x146 golang.org/x/text/collate.New(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30972d01) /Users/andy/projects/sync_gateway/godeps/src/golang.org/x/text/collate/collate.go:50 +0x104 github.com/couchbase/sg-bucket.(*JSONCollator).compareStrings(0xc420017d38, 0x4829eed, 0x0, 0xc42032494b, 0x4, 0x0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/collate.go:101 +0xc7 github.com/couchbase/sg-bucket.(*JSONCollator).Collate(0xc420017d38, 0x471b5c0, 0xc42029af90, 0x471b5c0, 0xc420014670, 0xa) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/collate.go:57 +0x217 github.com/couchbase/sg-bucket.(*ViewResult).Less(0xc420017d00, 0x1, 0x0, 0x4829501) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sg-bucket/views.go:220 +0x7b sort.insertionSort(0x4c1b120, 0xc420017d00, 0x0, 0x2) /usr/local/go/src/sort/sort.go:29 +0x71 sort.quickSort(0x4c1b120, 0xc420017d00, 0x0, 0x2, 0x4) /usr/local/go/src/sort/sort.go:211 +0x1eb sort.Sort(0x4c1b120, 0xc420017d00) /usr/local/go/src/sort/sort.go:220 +0x79 github.com/couchbaselabs/walrus.(*lolrus).updateView(0xc42018a2d0, 0xc4201974a0, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbaselabs/walrus/views.go:256 +0x7e8 github.com/couchbaselabs/walrus.(*lolrus).View(0xc42018a2d0, 0x482b193, 0xc, 0x4829530, 0xa, 0xc420179ad0, 0x0, 0x0, 0x0, 0x0, ...) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbaselabs/walrus/views.go:151 +0x30f github.com/couchbase/sync_gateway/db.(*DatabaseContext).AllPrincipalIDs(0xc420193b00, 0x0, 0x5800000, 0x0, 0x4625536, 0xc4200cb980, 0x402b15e, 0xc400000008, 0xc4200cb980) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/db/database.go:690 +0x170 github.com/couchbase/sync_gateway/rest.(*handler).getUsers(0xc420580cf0, 0xc4201bcb80, 0xc420193cf0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/rest/admin_api.go:494 +0x39 github.com/couchbase/sync_gateway/rest.(*handler).invoke(0xc420580cf0, 0x485bad0, 0x0, 0x0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/rest/handler.go:221 +0x2c9 github.com/couchbase/sync_gateway/rest.makeHandler.func1(0x4c1b3a0, 0xc42053db60, 0xc420494400) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/rest/handler.go:96 +0x80 net/http.HandlerFunc.ServeHTTP(0xc42051fb60, 0x4c1b3a0, 0xc42053db60, 0xc420494400) /usr/local/go/src/net/http/server.go:1934 +0x44 github.com/gorilla/mux.(*Router).ServeHTTP(0xc42058e2d0, 0x4c1b3a0, 0xc42053db60, 0xc420494400) /Users/andy/projects/sync_gateway/godeps/src/github.com/gorilla/mux/mux.go:86 +0x1fc github.com/couchbase/sync_gateway/rest.wrapRouter.func1(0x4c1b3a0, 0xc42053db60, 0xc420494400) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/rest/routing.go:297 +0x669 net/http.HandlerFunc.ServeHTTP(0xc4201bc760, 0x4c1b3a0, 0xc42053db60, 0xc420494400) /usr/local/go/src/net/http/server.go:1934 +0x44 github.com/couchbase/sync_gateway/rest.(*restTester).sendAdminRequest(0xc4201ba640, 0x48223eb, 0x3, 0x4828a68, 0xa, 0x0, 0x0, 0xc4204bc3e0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/rest/api_test.go:218 +0x2a2 github.com/couchbase/sync_gateway/rest.TestUserAPI(0xc420146dd0) /Users/andy/projects/sync_gateway/godeps/src/github.com/couchbase/sync_gateway/rest/admin_api_test.go:50 +0x873 testing.tRunner(0xc420146dd0, 0x485c0c0) /usr/local/go/src/testing/testing.go:656 +0x93 created by testing.(*T).Run /usr/local/go/src/testing/testing.go:693 +0x2c4 FAIL github.com/couchbase/sync_gateway/rest 0.106s
Looks like the same issue flagged in #2433.
When running SG unit tests with Golang 1.8, multiple tests panic.
Here are two examples: