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

fix(dgraph): fixing race condition in disk storage sync and save #7263

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

aman-bansal
Copy link
Contributor

@aman-bansal aman-bansal commented Jan 8, 2021

This PR fix following race condition

Write at 0x00c000306e00 by goroutine 242:
  github.com/dgraph-io/ristretto/z.(*MmapFile).Truncate()
      /home/agent/go/pkg/mod/github.com/dgraph-io/[email protected]/z/file_linux.go:35 +0x479
  github.com/dgraph-io/ristretto/z.(*MmapFile).AllocateSlice()
      /home/agent/go/pkg/mod/github.com/dgraph-io/[email protected]/z/file.go:148 +0x279
  github.com/dgraph-io/dgraph/raftwal.(*wal).AddEntries()
      /home/agent/work/4c273890c7f2d4e2/raftwal/wal.go:184 +0x8fa
  github.com/dgraph-io/dgraph/raftwal.(*DiskStorage).Save()
      /home/agent/work/4c273890c7f2d4e2/raftwal/storage.go:332 +0xf8
  github.com/dgraph-io/dgraph/conn.(*Node).SaveToStorage()
      /home/agent/work/4c273890c7f2d4e2/conn/node.go:288 +0xf7
  github.com/dgraph-io/dgraph/worker.(*node).Run()
      /home/agent/work/4c273890c7f2d4e2/worker/draft.go:1195 +0x40c

Previous read at 0x00c000306e00 by goroutine 248:
  github.com/dgraph-io/ristretto/z.(*MmapFile).Sync()
      /home/agent/go/pkg/mod/github.com/dgraph-io/[email protected]/z/file.go:161 +0x1a4
  github.com/dgraph-io/dgraph/raftwal.(*DiskStorage).Sync()
      /home/agent/work/4c273890c7f2d4e2/raftwal/storage.go:380 +0x96
  github.com/dgraph-io/dgraph/x.StoreSync()
      /home/agent/work/4c273890c7f2d4e2/x/x.go:1065 +0x1e2

Goroutine 242 (running) created at:
  github.com/dgraph-io/dgraph/worker.(*node).InitAndStartNode()
      /home/agent/work/4c273890c7f2d4e2/worker/draft.go:1737 +0x849
  github.com/dgraph-io/dgraph/worker.StartRaftNodes()
      /home/agent/work/4c273890c7f2d4e2/worker/groups.go:147 +0xbd9
  github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run.func4()
      /home/agent/work/4c273890c7f2d4e2/dgraph/cmd/alpha/run.go:760 +0x73

Goroutine 248 (running) created at:
  github.com/dgraph-io/dgraph/worker.(*node).Run()
      /home/agent/work/4c273890c7f2d4e2/worker/draft.go:1076 +0x31ef
==================

This change is Reviewable

@aman-bansal aman-bansal merged commit d13e744 into master Jan 8, 2021
@aman-bansal aman-bansal deleted the aman/fix_race_storage branch January 8, 2021 12:31
aman-bansal added a commit that referenced this pull request Jan 12, 2021
* fix(race): fixing race condition in localcache (#7140)

* fixing race condition in localcache

* name refactor

* fixing race in pick postings + fixing race log in t.go (#7149)

* fixing race condition in process subgraph (#7156)

* fixing race condition in disk storage sync and save (#7263)

* fixing bgindex + fix alpha z.closer (#7266)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants