Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql server failing after bump of mongo-driver to 1.15.0 #4686

Open
Calvinaud opened this issue Jun 4, 2024 · 0 comments
Open

Graphql server failing after bump of mongo-driver to 1.15.0 #4686

Calvinaud opened this issue Jun 4, 2024 · 0 comments
Labels

Comments

@Calvinaud
Copy link
Contributor

Calvinaud commented Jun 4, 2024

What happened:

The graphql server fail to start with the following logs when using the master branch.

Defaulted container "graphql-server" out of: graphql-server, wait-for-mongodb (init)
{"file":"/gql-server/server.go:43","func":"main.init.0","level":"info","msg":"go version: go1.20.14","time":"2024-06-04T07:07:27Z"}
{"file":"/gql-server/server.go:44","func":"main.init.0","level":"info","msg":"go os/arch: linux/amd64","time":"2024-06-04T07:07:27Z"}
{"file":"/gql-server/pkg/database/mongodb/init.go:109","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.MongoConnection","level":"info","msg":"connected to mongo","time":"2024-06-04T07:07:27Z"}
{"error":"(NamespaceExists) Collection already exists. NS: litmus.chaosInfrastructures","file":"/gql-server/pkg/database/mongodb/init.go:130","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.(*MongoClient).initAllCollection","level":"error","msg":"failed to create chaosInfrastructures collection","time":"2024-06-04T07:07:27Z"}
{"error":"(NamespaceExists) Collection already exists. NS: litmus.chaosExperiments","file":"/gql-server/pkg/database/mongodb/init.go:154","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.(*MongoClient).initAllCollection","level":"error","msg":"failed to create chaosExperiments collection","time":"2024-06-04T07:07:27Z"}
{"error":"(NamespaceExists) Collection already exists. NS: litmus.chaosExperimentRuns","file":"/gql-server/pkg/database/mongodb/init.go:178","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.(*MongoClient).initAllCollection","level":"error","msg":"failed to create chaosExperimentRuns collection","time":"2024-06-04T07:07:27Z"}
{"error":"(NamespaceExists) Collection already exists. NS: litmus.chaosHubs","file":"/gql-server/pkg/database/mongodb/init.go:196","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.(*MongoClient).initAllCollection","level":"error","msg":"failed to create chaosHubs collection","time":"2024-06-04T07:07:27Z"}
{"error":"(NamespaceExists) Collection already exists. NS: litmus.chaosProbes","file":"/gql-server/pkg/database/mongodb/init.go:275","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.(*MongoClient).initAllCollection","level":"error","msg":"failed to create chaosProbes collection","time":"2024-06-04T07:07:27Z"}
{"file":"/gql-server/server.go:143","func":"main.main","level":"info","msg":"chaos manager running at http://localhost:8080","time":"2024-06-04T07:07:27Z"}
{"file":"/gql-server/pkg/chaoshub/service.go:960","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaoshub.(*chaosHubService).SyncDefaultChaosHubs","level":"info","msg":"syncing default chaos hub directories","time":"2024-06-04T07:07:27Z"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb413ec]

goroutine 151 [running]:
go.mongodb.org/mongo-driver/mongo.(*Collection).Find(0xc0006c2180?, {0x0, 0x0}, {0x1da82e0, 0xc0006b65a0}, {0x0, 0x0, 0x0})
        /go/pkg/mod/go.mongodb.org/mongo-driver@v1.15.0/mongo/collection.go:1209 +0x4c
github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb.(*MongoOperations).List(0x449171?, {0x0, 0x0}, 0xc000155da8?, {0xc0006c2180, 0x1, 0x1}, {0x0, 0x0, 0x0})
        /gql-server/pkg/database/mongodb/operations.go:90 +0xac
github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb/chaos_hub.(*Operator).GetHubs(0xc000610e30, {0x0, 0x0})
        /gql-server/pkg/database/mongodb/chaos_hub/operations.go:53 +0x83
github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaoshub.(*chaosHubService).GetAllHubs(0x0?, {0x0?, 0x0?})
        /gql-server/pkg/chaoshub/service.go:855 +0x3e
github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaoshub.(*chaosHubService).RecurringHubSync(0xc000610a10?)
        /gql-server/pkg/chaoshub/service.go:872 +0x56
created by main.main
        /gql-server/server.go:123 +0x638

The issue seem related to #4661 which bump the mongo-driver to 1.15.0. Reverting to version 1.11.4 fix the issue.

The issue above about both with a fresh mongoDB or with an existing one.

The issue seem to happen with different mongo version I tried with:

  • 5.0.8-debian-10-r24
  • 5.0.21-debian-11-r18

I'm not sure if the issue is coming directly from the driver or not.

What you expected to happen:

The graphql should start correctly.

How to reproduce it (as minimally and precisely as possible):
Build an image of the graphql server from the master branch.
Use this image when deploying the litmus portal server.
Wait for the init-container to complete.
The pod will fail.

@Calvinaud Calvinaud added the bug label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant