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

RAFT: fix data race on registering call backs and atomic lastAppliedI… #4914

Merged
merged 1 commit into from
May 14, 2024

Conversation

moogacs
Copy link
Contributor

@moogacs moogacs commented May 14, 2024

…ndexOnStart

Apply it could be called concurrently, so we convert lastAppliedIndexOnStart to atomic

also sometime we end up in data race situations

WARNING: DATA RACE
2024-05-14 11:34:02 Write at 0x00c00288e0c0 by main goroutine:
2024-05-14 11:34:02   github.com/weaviate/weaviate/usecases/schema.(*executor).RegisterSchemaUpdateCallback()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/usecases/schema/executor.go:218 +0x4a5c
2024-05-14 11:34:02   github.com/weaviate/weaviate/adapters/handlers/rest.MakeAppState()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/adapters/handlers/rest/configure_api.go:363 +0x49b8
2024-05-14 11:34:02   github.com/weaviate/weaviate/adapters/handlers/rest.configureAPI()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/adapters/handlers/rest/configure_api.go:464 +0xe4
2024-05-14 11:34:02   github.com/weaviate/weaviate/adapters/handlers/rest.(*Server).ConfigureAPI()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/adapters/handlers/rest/server.go:68 +0x720
2024-05-14 11:34:02   main.main()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cmd/weaviate-server/main.go:62 +0x6f0
2024-05-14 11:34:02 
2024-05-14 11:34:02 Previous read at 0x00c00288e0c0 by goroutine 128:
2024-05-14 11:34:02   github.com/weaviate/weaviate/usecases/schema.(*executor).rebuildGQL()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/usecases/schema/executor.go:203 +0xf0
2024-05-14 11:34:02   github.com/weaviate/weaviate/usecases/schema.(*executor).TriggerSchemaUpdateCallbacks()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/usecases/schema/executor.go:211 +0x28
2024-05-14 11:34:02   github.com/weaviate/weaviate/cluster/store.(*localDB).apply()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cluster/store/db.go:286 +0x144
2024-05-14 11:34:02   github.com/weaviate/weaviate/cluster/store.(*localDB).AddClass()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cluster/store/db.go:55 +0x520
2024-05-14 11:34:02   github.com/weaviate/weaviate/cluster/store.(*Store).Apply()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cluster/store/store.go:674 +0xaf4
2024-05-14 11:34:02   github.com/hashicorp/raft.(*Raft).runFSM.func1()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/vendor/github.com/hashicorp/raft/fsm.go:101 +0x2d4
2024-05-14 11:34:02   github.com/hashicorp/raft.(*Raft).runFSM.func2()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/vendor/github.com/hashicorp/raft/fsm.go:124 +0x6a4
2024-05-14 11:34:02   github.com/hashicorp/raft.(*Raft).runFSM()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/vendor/github.com/hashicorp/raft/fsm.go:240 +0x508
2024-05-14 11:34:02   github.com/hashicorp/raft.(*Raft).runFSM-fm()
2024-05-14 11:34:02       <autogenerated>:1 +0x34
2024-05-14 11:34:02   github.com/hashicorp/raft.(*raftState).goFunc.func1()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/vendor/github.com/hashicorp/raft/state.go:149 +0x8c
2024-05-14 11:34:02 
2024-05-14 11:34:02 Goroutine 128 (running) created at:
2024-05-14 11:34:02   github.com/hashicorp/raft.(*raftState).goFunc()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/vendor/github.com/hashicorp/raft/state.go:147 +0xd8
2024-05-14 11:34:02   github.com/hashicorp/raft.NewRaft()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/vendor/github.com/hashicorp/raft/api.go:605 +0x12ac
2024-05-14 11:34:02   github.com/weaviate/weaviate/cluster/store.(*Store).Open()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cluster/store/store.go:251 +0x448
2024-05-14 11:34:02   github.com/weaviate/weaviate/cluster/store.(*Service).Open()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cluster/store/service.go:58 +0x180
2024-05-14 11:34:02   github.com/weaviate/weaviate/cluster.(*Service).Open()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/cluster/cluster.go:67 +0x1ac
2024-05-14 11:34:02   github.com/weaviate/weaviate/adapters/handlers/rest.MakeAppState.func3()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/adapters/handlers/rest/configure_api.go:340 +0x6c
2024-05-14 11:34:02   github.com/weaviate/weaviate/entities/errors.GoWrapper.func1()
2024-05-14 11:34:02       /go/src/github.com/weaviate/weaviate/entities/errors/go_wrapper.go:34 +0x90

What's being changed:

Review checklist

  • Documentation has been updated, if necessary. Link to changed documentation:
  • Chaos pipeline run or not necessary. Link to pipeline:
  • All new code is covered by tests where it is reasonable.
  • Performance tests have been run or not necessary.

Copy link

sonarcloud bot commented May 14, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@moogacs moogacs merged commit 4d46bbc into stable/v1.25 May 14, 2024
42 checks passed
@moogacs moogacs deleted the fix-data-race branch May 14, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants