sourcenetwork / defradb

DefraDB is a Peer-to-Peer Edge Database. It's the core data storage system for the Source Network Ecosystem, built with IPLD, LibP2P, CRDTs, and Semantic open web properties.
445 stars 43 forks source link

Flaky test TestQueryWithIndexOnManyToOne_MultipleViaOneToMany #2875

Open nasdf opened 3 months ago

nasdf commented 3 months ago
=== Failed
=== FAIL: tests/integration/index TestQueryWithIndexOnManyToOne_MultipleViaOneToMany (0.13s)
Jul 26 20:58:33.278 INF tests.integration  database=badger-in-memory client=http mutationType=collection-save databaseDir="" badgerEncryption=false skipNetworkTests=false changeDetector.Enabled=false changeDetector.SetupOnly=false changeDetector.SourceBranch=develop changeDetector.TargetBranch="" changeDetector.Repository=https://github.com/sourcenetwork/defradb.git
2024/07/26 20:58:33 http: panic serving 127.0.0.1:56696: Unclosed iterator at time of Txn.Discard.
goroutine 85074 [running]:
net/http.(*conn).serve.func1()
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:1868 +0xfc
panic({0x62e7880?, 0x84eb9c0?})
    /opt/hostedtoolcache/go/1.21.3/x64/src/runtime/panic.go:920 +0x270
github.com/sourcenetwork/badger/v4.(*Txn).Discard(0xc000f44400)
    /home/runner/go/pkg/mod/github.com/sourcenetwork/badger/v4@v4.2.1-0.20231113215945-a63444ca5276/txn.go:524 +0x1fe
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).discard(...)
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:780
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).Discard(0xc000d490b0, {0x4ed6d5?, 0xc00237f6f8?})
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:776 +0x1c5
github.com/sourcenetwork/defradb/datastore.(*txn).Discard(0xc0016515c0, {0x853b360, 0xc0023c10b0})
    /home/runner/work/defradb/defradb/datastore/txn.go:125 +0xb5
panic({0x62e7880?, 0x84eb9c0?})
    /opt/hostedtoolcache/go/1.21.3/x64/src/runtime/panic.go:920 +0x270
make: *** [Makefile:307: test:coverage] Error 1
github.com/sourcenetwork/badger/v4.(*Txn).Discard(0xc000f44400)
    /home/runner/go/pkg/mod/github.com/sourcenetwork/badger/v4@v4.2.1-0.20231113215945-a63444ca5276/txn.go:524 +0x1fe
github.com/sourcenetwork/badger/v4.(*Txn).Commit(0xc000f44400)
    /home/runner/go/pkg/mod/github.com/sourcenetwork/badger/v4@v4.2.1-0.20231113215945-a63444ca5276/txn.go:665 +0x17f
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).commit(0xc000d490b0)
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:765 +0x98
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).Commit(0xc000d490b0, {0x0?, 0x0?})
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:761 +0x198
github.com/sourcenetwork/defradb/datastore.(*txn).Commit(0xc0016515c0, {0x853b360, 0xc0023c10b0})
    /home/runner/work/defradb/defradb/datastore/txn.go:106 +0xa9
github.com/sourcenetwork/defradb/internal/db.(*db).ExecRequest(0xc001927a00?, {0x853b360, 0xc0023c0f90}, {0xc0023bfe60, 0x5f})
    /home/runner/work/defradb/defradb/internal/db/store.go:38 +0x36f
github.com/sourcenetwork/defradb/http.(*storeHandler).ExecRequest(0xc001412a00?, {0x851a290?, 0xc000ce87e0}, 0xc001927a00)
    /home/runner/work/defradb/defradb/http/handler_store.go:315 +0x43b
net/http.HandlerFunc.ServeHTTP(0xc001412a00, {0x851a290, 0xc000ce87e0}, 0xc0023bd8e8?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0024a2a20, {0x851a290, 0xc000ce87e0}, 0xc001927a00)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:459 +0x526
net/http.HandlerFunc.ServeHTTP(0xc001412330, {0x851a290, 0xc000ce87e0}, 0x6559f80?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0024a2a20, {0x851a290, 0xc000ce87e0}, 0xc001927a00)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:73 +0x6f5
github.com/sourcenetwork/defradb/http.(*Router).ServeHTTP(0xc0002d8810, {0x851a290, 0xc000ce87e0}, 0xc0023bd8e8?)
    /home/runner/work/defradb/defradb/http/router.go:67 +0xac
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0024a2e40, {0x851a290, 0xc000ce87e0}, 0xc001927a00)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:459 +0x526
net/http.HandlerFunc.ServeHTTP(0xc0012fa1f0, {0x851a290, 0xc000ce87e0}, 0x56c4620?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/sourcenetwork/defradb/http.AuthMiddleware.func1({0x851a290, 0xc000ce87e0}, 0xc001927a00)
    /home/runner/work/defradb/defradb/http/auth.go:57 +0x5ed
net/http.HandlerFunc.ServeHTTP(0xc0019d9f20, {0x851a290, 0xc000ce87e0}, 0x0?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/sourcenetwork/defradb/http.TransactionMiddleware.func1({0x851a290, 0xc000ce87e0}, 0xc001927a00)
    /home/runner/work/defradb/defradb/http/middleware.go:83 +0x59a
net/http.HandlerFunc.ServeHTTP(0xc0019d9f50, {0x851a290, 0xc000ce87e0}, 0xc00193f8f0?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/sourcenetwork/defradb/http.NewHandler.func1.ApiMiddleware.func1.1({0x851a290, 0xc000ce87e0}, 0xc001871770?)
    /home/runner/work/defradb/defradb/http/middleware.go:71 +0x17d
net/http.HandlerFunc.ServeHTTP(0xc001ed95f0, {0x851a290, 0xc000ce87e0}, 0x7?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0024a2e40, {0x851a290, 0xc000ce87e0}, 0xc001927900)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:73 +0x6f5
github.com/go-chi/chi/v5.(*Mux).Mount.func1({0x851a290, 0xc000ce87e0}, 0xc001927900)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:327 +0x4e6
net/http.HandlerFunc.ServeHTTP(0xc0013db580, {0x851a290, 0xc000ce87e0}, 0xc001879965?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc0024a2de0, {0x851a290, 0xc000ce87e0}, 0xc001927900)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:459 +0x526
net/http.HandlerFunc.ServeHTTP(0xc0012fa210, {0x851a290, 0xc000ce87e0}, 0xb0533e0?)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2136 +0x48
github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc0024a2de0, {0x851a290, 0xc000ce87e0}, 0xc001926b00)
    /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.1.0/mux.go:90 +0x67c
github.com/sourcenetwork/defradb/http.(*Handler).ServeHTTP(0xc0013db6a0, {0x851a290, 0xc000ce87e0}, 0x0?)
    /home/runner/work/defradb/defradb/http/handler.go:107 +0xa9
net/http.serverHandler.ServeHTTP({0x850b598?}, {0x851a290, 0xc000ce87e0}, 0xc001926b00)
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2938 +0x2a2
net/http.(*conn).serve(0xc000158f30, {0x853b360, 0xc001992120})
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:2009 +0xc25
created by net/http.(*Server).Serve in goroutine 85039
    /opt/hostedtoolcache/go/1.21.3/x64/src/net/http/server.go:3086 +0x80d
    utils2.go:1820: 
            Error Trace:    /home/runner/work/defradb/defradb/tests/integration/utils2.go:1820
                                        /home/runner/work/defradb/defradb/tests/integration/utils2.go:1852
                                        /home/runner/work/defradb/defradb/tests/integration/utils2.go:1720
                                        /home/runner/work/defradb/defradb/tests/integration/utils2.go:336
                                        /home/runner/work/defradb/defradb/tests/integration/utils2.go:226
                                        /home/runner/work/defradb/defradb/tests/integration/utils2.go:180
                                        /home/runner/work/defradb/defradb/tests/integration/index/query_with_relation_filter_test.go:980
            Error:          Should be empty, but was [Post "http://127.0.0.1:45527/api/v0/graphql": EOF]
            Test:           TestQueryWithIndexOnManyToOne_MultipleViaOneToMany
Jul 26 20:58:33.382 INF db Closing DefraDB process...
Jul 26 20:58:33.410 INF db Successfully closed running process
nasdf commented 3 months ago
=== FAIL: tests/integration/index TestQueryWithIndexOnManyToOne_MultipleViaOneToMany (0.16s)
Jul 30 22:15:59.263 INF tests.integration  database=badger-file-system client=go mutationType=collection-named databaseDir="" badgerEncryption=false skipNetworkTests=false changeDetector.Enabled=false changeDetector.SetupOnly=false changeDetector.SourceBranch=develop changeDetector.TargetBranch="" changeDetector.Repository=https://github.com/sourcenetwork/defradb.git
Jul 30 22:15:59.372 INF db Closing DefraDB process...
Jul 30 22:15:59.425 INF db Successfully closed running process
panic: Unclosed iterator at time of Txn.Discard.
    panic: Unclosed iterator at time of Txn.Discard. [recovered]
    panic: Unclosed iterator at time of Txn.Discard.

goroutine 53426 [running]:
testing.tRunner.func1.2({0x62f39a0, 0x84fa040})
    /opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1545 +0x366
testing.tRunner.func1()
    /opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1548 +0x630
panic({0x62f39a0?, 0x84fa040?})
    /opt/hostedtoolcache/go/1.21.3/x64/src/runtime/panic.go:920 +0x270
github.com/sourcenetwork/badger/v4.(*Txn).Discard(0xc000e5c280)
    /home/runner/go/pkg/mod/github.com/sourcenetwork/badger/v4@v4.2.1-0.20231113215945-a63444ca5276/txn.go:524 +0x1fe
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).discard(...)
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:780
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).Discard(0xc007e2b158, {0x4ed6d5?, 0xc007e9ef18?})
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:776 +0x1c5
github.com/sourcenetwork/defradb/datastore.(*txn).Discard(0xc001646780, {0x85499e0, 0xc001711920})
    /home/runner/work/defradb/defradb/datastore/txn.go:125 +0xb5
panic({0x62f39a0?, 0x84fa040?})
    /opt/hostedtoolcache/go/1.21.3/x64/src/runtime/panic.go:920 +0x270
github.com/sourcenetwork/badger/v4.(*Txn).Discard(0xc000e5c280)
    /home/runner/go/pkg/mod/github.com/sourcenetwork/badger/v4@v4.2.1-0.20231113215945-a63444ca5276/txn.go:524 +0x1fe
github.com/sourcenetwork/badger/v4.(*Txn).Commit(0xc000e5c280)
    /home/runner/go/pkg/mod/github.com/sourcenetwork/badger/v4@v4.2.1-0.20231113215945-a63444ca5276/txn.go:665 +0x17f
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).commit(0xc007e2b158)
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:765 +0x98
github.com/sourcenetwork/defradb/datastore/badger/v4.(*txn).Commit(0xc007e2b158, {0x0?, 0x0?})
    /home/runner/work/defradb/defradb/datastore/badger/v4/datastore.go:761 +0x198
github.com/sourcenetwork/defradb/datastore.(*txn).Commit(0xc001646780, {0x85499e0, 0xc001711920})
    /home/runner/work/defradb/defradb/datastore/txn.go:106 +0xa9
github.com/sourcenetwork/defradb/internal/db.(*db).ExecRequest(0x68398c0?, {0x85499e0, 0xc001711860}, {{0x6cfe055?, 0x47eff4?}, {0x0?, 0x0?}})
    /home/runner/work/defradb/defradb/internal/db/store.go:38 +0x383
github.com/sourcenetwork/defradb/tests/integration.executeRequest(0xc001818000, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x6cfe055, 0x5f}, {0x0, ...}, ...})
    /home/runner/work/defradb/defradb/tests/integration/utils2.go:1708 +0x382
github.com/sourcenetwork/defradb/tests/integration.performAction(0xc001818000, 0x0?, {0x692b0a0?, 0xc000df0080?})
    /home/runner/work/defradb/defradb/tests/integration/utils2.go:336 +0x1347
github.com/sourcenetwork/defradb/tests/integration.executeTestCase({0x8549970?, 0xc1ade00}, {0x859cf18?, 0xc001c81860?}, {0xc000bd4180, 0x3, 0x3}, {{0x0, 0x0}, {0xc000c400a0, ...}, ...}, ...)
    /home/runner/work/defradb/defradb/tests/integration/utils2.go:226 +0x1276
github.com/sourcenetwork/defradb/tests/integration.ExecuteTestCase({0x859cf18?, 0xc001c81860}, {{0x0, 0x0}, {0xc000c400a0, 0x5, 0x5}, {0x0, {0x0, 0x0, ...}}, ...})
    /home/runner/work/defradb/defradb/tests/integration/utils2.go:180 +0xade
github.com/sourcenetwork/defradb/tests/integration/index.TestQueryWithIndexOnManyToOne_MultipleViaOneToMany(0x0?)
make: *** [Makefile:307: test:coverage] Error 1
    /home/runner/work/defradb/defradb/tests/integration/index/query_with_relation_filter_test.go:1018 +0xb88
testing.tRunner(0xc001c81860, 0x6f9cde8)
    /opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1595 +0x239
created by testing.(*T).Run in goroutine 1
    /opt/hostedtoolcache/go/1.21.3/x64/src/testing/testing.go:1648 +0x82b