Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bisync: race in concurrent tests #8815

@ncw

Description

@ncw

I spotted a race in the bisync concurrent tests here

https://github.com/rclone/rclone/actions/runs/17645223715/job/50141442696

Which is from here

buf.WriteString(text)

and here

return buf.Bytes()

Not sure what is going on though!

Details

==================
WARNING: DATA RACE
Write at 0x00c0014981e0 by goroutine 31063:
  bytes.(*Buffer).tryGrowByReslice()
      /opt/hostedtoolcache/go/1.25.1/x64/src/bytes/buffer.go:123 +0xa5
  bytes.(*Buffer).WriteString()
      /opt/hostedtoolcache/go/1.25.1/x64/src/bytes/buffer.go:195 +0xb9
  github.com/rclone/rclone/cmd/bisync/bilib.CaptureOutput.func1()
      /home/runner/work/rclone/rclone/cmd/bisync/bilib/output.go:16 +0x3e
  github.com/rclone/rclone/fs/log.(*OutputHandler).Handle()
      /home/runner/work/rclone/rclone/fs/log/slog.go:369 +0x602
  log/slog.(*Logger).log()
      /opt/hostedtoolcache/go/1.25.1/x64/src/log/slog/logger.go:256 +0x24c
  log/slog.Log()
      /opt/hostedtoolcache/go/1.25.1/x64/src/log/slog/logger.go:321 +0x9a
  github.com/rclone/rclone/fs.logSlog()
      /home/runner/work/rclone/rclone/fs/log.go:137 +0xe4
  github.com/rclone/rclone/fs.logSlogWithObject()
      /home/runner/work/rclone/rclone/fs/log.go:147 +0x5d8
  github.com/rclone/rclone/fs.LogPrint()
      /home/runner/work/rclone/rclone/fs/log.go:152 +0x86
  github.com/rclone/rclone/fs.LogLevelPrint()
      /home/runner/work/rclone/rclone/fs/log.go:170 +0x64
  github.com/rclone/rclone/fs.Infoc()
      /home/runner/work/rclone/rclone/fs/log.go:262 +0x1ba4
  github.com/rclone/rclone/cmd/bisync.Bisync()
      /home/runner/work/rclone/rclone/cmd/bisync/operations.go:218 +0x1b73
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).resyncDir()
      /home/runner/work/rclone/rclone/cmd/bisync/queue.go:297 +0x16c
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).resync()
      /home/runner/work/rclone/rclone/cmd/bisync/resync.go:125 +0xdfa
  encoding/json.MarshalIndent()
      /opt/hostedtoolcache/go/1.25.1/x64/src/encoding/json/encode.go:222 +0x6b
  github.com/rclone/rclone/cmd/bisync.prettyprint()
      /home/runner/work/rclone/rclone/cmd/bisync/log.go:104 +0x74
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).resyncDir()
      /home/runner/work/rclone/rclone/cmd/bisync/queue.go:297 +0x16c
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).resync()
      /home/runner/work/rclone/rclone/cmd/bisync/resync.go:115 +0xcd8
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).runLocked()
      /home/runner/work/rclone/rclone/cmd/bisync/operations.go:276 +0x2f30
  github.com/rclone/rclone/cmd/bisync.Bisync()
      /home/runner/work/rclone/rclone/cmd/bisync/operations.go:180 +0x1344
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runBisync.func3()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:1218 +0x99
  github.com/rclone/rclone/cmd/bisync/bilib.CaptureOutput()
      /home/runner/work/rclone/rclone/cmd/bisync/bilib/output.go:22 +0x196
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runBisync()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:1217 +0x17a4
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runTestStep()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:788 +0x584
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runTestCase()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:542 +0x23dc
  github.com/rclone/rclone/cmd/bisync_test.testBisync.func4()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:405 +0x2de
  testing.tRunner()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1934 +0x21c
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x44

Previous read at 0x00c0014981e0 by goroutine 31064:
  bytes.(*Buffer).Bytes()
      /opt/hostedtoolcache/go/1.25.1/x64/src/bytes/buffer.go:60 +0x1bd
  github.com/rclone/rclone/cmd/bisync/bilib.CaptureOutput()
      /home/runner/work/rclone/rclone/cmd/bisync/bilib/output.go:23 +0x1f6
  encoding/json.MarshalIndent()
      /opt/hostedtoolcache/go/1.25.1/x64/src/encoding/json/encode.go:222 +0x6b
  github.com/rclone/rclone/cmd/bisync.prettyprint()
      /home/runner/work/rclone/rclone/cmd/bisync/log.go:104 +0x74
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).resyncDir()
      /home/runner/work/rclone/rclone/cmd/bisync/queue.go:297 +0x16c
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).resync()
      /home/runner/work/rclone/rclone/cmd/bisync/resync.go:115 +0xcd8
  github.com/rclone/rclone/cmd/bisync.(*bisyncRun).runLocked()
      /home/runner/work/rclone/rclone/cmd/bisync/operations.go:276 +0x2f30
  github.com/rclone/rclone/cmd/bisync.Bisync()
      /home/runner/work/rclone/rclone/cmd/bisync/operations.go:180 +0x1344
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runBisync.func3()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:1218 +0x99
  github.com/rclone/rclone/cmd/bisync/bilib.CaptureOutput()
      /home/runner/work/rclone/rclone/cmd/bisync/bilib/output.go:22 +0x196
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runBisync()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:1217 +0x17a4
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runTestStep()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:788 +0x584
  github.com/rclone/rclone/cmd/bisync_test.(*bisyncTest).runTestCase()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:542 +0x23dc
  github.com/rclone/rclone/cmd/bisync_test.testBisync.func4()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:405 +0x2de
  testing.tRunner()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1934 +0x21c
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x44

Goroutine 31063 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x9d2
  github.com/rclone/rclone/cmd/bisync_test.testBisync()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:398 +0x10c4
  github.com/rclone/rclone/cmd/bisync_test.TestBisyncRemoteRemote()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:280 +0x13b
  github.com/rclone/rclone/cmd/bisync_test.testParallel()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:312 +0x30
  testing.tRunner()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1934 +0x21c
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x44

Goroutine 31064 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x9d2
  github.com/rclone/rclone/cmd/bisync_test.testBisync()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:398 +0x10c4
  github.com/rclone/rclone/cmd/bisync_test.TestBisyncRemoteRemote()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:280 +0x13b
  github.com/rclone/rclone/cmd/bisync_test.testParallel()
      /home/runner/work/rclone/rclone/cmd/bisync/bisync_test.go:312 +0x30
  testing.tRunner()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1934 +0x21c
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.25.1/x64/src/testing/testing.go:1997 +0x44
==================

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions