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

Data Race when breaking block #740

Closed
Blackjack200 opened this issue Feb 1, 2023 · 1 comment
Closed

Data Race when breaking block #740

Blackjack200 opened this issue Feb 1, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@Blackjack200
Copy link
Contributor

Blackjack200 commented Feb 1, 2023

Issue description

Data race when breaking block

  • Expected result: WARNING: DATA RACE
  • Actual result: No data race

Steps to reproduce the issue

  1. git clone https://github.com/df-mc/dragonfly.git
  2. cd dragonfly
  3. go run --race main.go
  4. join the server
  5. break some block
  6. see the waring

OS and versions

  • Dragonfly: 89192ef
  • Go: go version go1.19.4 windows/amd64
  • Server OS: Windows 10 Professional 22H2
  • Game version: not related

Crashdump, backtrace or other files

==================
WARNING: DATA RACE
Write at 0x00c001b7c2d8 by goroutine 59:
  github.com/df-mc/dragonfly/server/world.(*Loader).Move()
      C:/Users/21847/GolandProjects/dragonfly/server/world/loader.go:71 +0x1c4
  github.com/df-mc/dragonfly/server/session.(*Session).sendChunks()
      C:/Users/21847/GolandProjects/dragonfly/server/session/session.go:359 +0xde
  github.com/df-mc/dragonfly/server/session.(*Session).background()
      C:/Users/21847/GolandProjects/dragonfly/server/session/session.go:336 +0x204
  github.com/df-mc/dragonfly/server/session.(*Session).handlePackets.func2()
      C:/Users/21847/GolandProjects/dragonfly/server/session/session.go:295 +0x39

Previous read at 0x00c001b7c2d8 by goroutine 33:
  github.com/df-mc/dragonfly/server/world.ticker.tickBlocksRandomly()
      C:/Users/21847/GolandProjects/dragonfly/server/world/tick.go:137 +0x17e
  github.com/df-mc/dragonfly/server/world.ticker.tick()
      C:/Users/21847/GolandProjects/dragonfly/server/world/tick.go:72 +0x505
  github.com/df-mc/dragonfly/server/world.ticker.tickLoop()
      C:/Users/21847/GolandProjects/dragonfly/server/world/tick.go:26 +0xd7
  github.com/df-mc/dragonfly/server/world.Config.New.func1()
      C:/Users/21847/GolandProjects/dragonfly/server/world/conf.go:88 +0x39

Goroutine 59 (running) created at:
  github.com/df-mc/dragonfly/server/session.(*Session).handlePackets()
      C:/Users/21847/GolandProjects/dragonfly/server/session/session.go:295 +0xba
  github.com/df-mc/dragonfly/server/session.(*Session).Start.func1()
      C:/Users/21847/GolandProjects/dragonfly/server/session/session.go:217 +0x39

Goroutine 33 (running) created at:
  github.com/df-mc/dragonfly/server/world.Config.New()
      C:/Users/21847/GolandProjects/dragonfly/server/world/conf.go:88 +0xa69
  github.com/df-mc/dragonfly/server.(*Server).createWorld()
      C:/Users/21847/GolandProjects/dragonfly/server/server.go:467 +0x477
  github.com/df-mc/dragonfly/server.Config.New()
      C:/Users/21847/GolandProjects/dragonfly/server/conf.go:157 +0x894
  main.main()
      C:/Users/21847/GolandProjects/dragonfly/main.go:24 +0x4b7
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  github.com/df-mc/goleveldb/leveldb.(*DB).checkAndCleanFiles()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db_util.go:52 +0x1fe
  github.com/df-mc/goleveldb/leveldb.openDB()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:136 +0x8b5
  fmt.(*ss).doScanf()
      D:/Go/src/fmt/scan.go:1230 +0x3fb
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  github.com/df-mc/goleveldb/leveldb.(*DB).recoverJournal()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:482 +0xb2
  github.com/df-mc/goleveldb/leveldb.openDB()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:131 +0x899
  github.com/df-mc/goleveldb/leveldb.Open()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:203 +0x35c
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  github.com/df-mc/goleveldb/leveldb.(*session).recover.func1()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/session.go:134 +0xd0
  runtime.deferreturn()
      D:/Go/src/runtime/panic.go:476 +0x32
  github.com/df-mc/goleveldb/leveldb.Open()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:189 +0x104
  github.com/df-mc/goleveldb/leveldb.OpenFile()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:225 +0x87
  github.com/df-mc/dragonfly/server/player/playerdb.NewProvider()
      C:/Users/21847/GolandProjects/dragonfly/server/player/playerdb/leveldb.go:26 +0xf8
  github.com/df-mc/dragonfly/server.UserConfig.Config()
      C:/Users/21847/GolandProjects/dragonfly/server/conf.go:267 +0x3da
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  github.com/df-mc/goleveldb/leveldb.(*DB).checkAndCleanFiles()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db_util.go:52 +0x1fe
  github.com/df-mc/goleveldb/leveldb.openDB()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:136 +0x8b5
  fmt.(*ss).doScanf()
      D:/Go/src/fmt/scan.go:1230 +0x3fb
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:643 +0x26
  github.com/df-mc/goleveldb/leveldb/storage.(*fileStorage).List()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/storage/file_storage.go:458 +0x3e6
  fmt.Fscanf()
      D:/Go/src/fmt/scan.go:143 +0xe9
  fmt.Sscanf()
      D:/Go/src/fmt/scan.go:114 +0x164
  github.com/df-mc/goleveldb/leveldb/storage.fsParseName()
  github.com/df-mc/goleveldb/leveldb.OpenFile()
      C:/Users/21847/go/pkg/mod/github.com/df-mc/goleveldb@v1.1.9/leveldb/db.go:225 +0x87
  github.com/df-mc/dragonfly/server/world/mcdb.New()
      C:/Users/21847/GolandProjects/dragonfly/server/world/mcdb/provider.go:70 +0x5bb
  github.com/df-mc/dragonfly/server.UserConfig.Config()
      C:/Users/21847/GolandProjects/dragonfly/server/conf.go:257 +0x1be
  main.readConfig()
      C:/Users/21847/GolandProjects/dragonfly/main.go:54 +0x967
  main.main()
      C:/Users/21847/GolandProjects/dragonfly/main.go:19 +0x3b1
==================
@Blackjack200
Copy link
Contributor Author

streamable not avaiable, watch this https://youtu.be/GVRQj_VPsek

@JustTalDevelops JustTalDevelops added the bug Something isn't working label Feb 2, 2023
@JustTalDevelops JustTalDevelops added this to the v0.10.0 milestone Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants