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

Found data race in the "tcpServer" #10

Closed
mstmdev opened this issue Jan 28, 2022 · 1 comment
Closed

Found data race in the "tcpServer" #10

mstmdev opened this issue Jan 28, 2022 · 1 comment
Labels
race Data race

Comments

@mstmdev
Copy link
Member

mstmdev commented Jan 28, 2022

Running command (Windows 10)

$ go version
go version go1.17.6 windows/amd64
$ cd E:/workspace/gowork/src/github.com/no-src/gofs
$ mkdir rs\source rs\dest rc\source rc\dest
# server
$ go run -race ./cmd/gofs -source="rs://127.0.0.1:9016?mode=server&local_sync_disabled=true&path=./rs/source" -dest=./rs/dest -tls_cert_file=./gofs.pem -tls_key_file=./gofs.key -users="u1234|p4321"
# client
$ go run -race ./cmd/gofs -source="rs://127.0.0.1:9016" -dest=./rc/dest -users="u1234|p4321"

Server error info

==================
WARNING: DATA RACE
Write at 0x00c00002c690 by goroutine 15:
  runtime.mapassign_faststr()
      C:/Go/src/runtime/map_faststr.go:202 +0x0
  github.com/no-src/gofs/tran.(*tcpServer).addClient()
      E:/workspace/gowork/src/github.com/no-src/gofs/tran/tcpserver.go:120 +0x107
  github.com/no-src/gofs/tran.(*tcpServer).Accept()
      E:/workspace/gowork/src/github.com/no-src/gofs/tran/tcpserver.go:91 +0xea
  github.com/no-src/gofs/sync.(*remoteServerSync).start·dwrap·3()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/remote_server_sync.go:209 +0x59

Previous read at 0x00c00002c690 by goroutine 20:
  runtime.mapiterinit()
      C:/Go/src/runtime/map.go:802 +0x0
  github.com/no-src/gofs/tran.(*tcpServer).Send()
      E:/workspace/gowork/src/github.com/no-src/gofs/tran/tcpserver.go:147 +0xa7
  github.com/no-src/gofs/sync.(*remoteServerSync).send()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/remote_server_sync.go:189 +0x7b2
  github.com/no-src/gofs/sync.(*remoteServerSync).Write()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/remote_server_sync.go:90 +0x7d
  github.com/no-src/gofs/monitor.(*baseMonitor).startSyncWrite.func1()
      E:/workspace/gowork/src/github.com/no-src/gofs/monitor/base_monitor.go:121 +0x67
  github.com/no-src/gofs/retry.(*defaultRetry).DoWithContext()
      E:/workspace/gowork/src/github.com/no-src/gofs/retry/default_retry.go:40 +0x161
  github.com/no-src/gofs/retry.(*defaultRetry).Do()
      E:/workspace/gowork/src/github.com/no-src/gofs/retry/default_retry.go:29 +0x6b
  github.com/no-src/gofs/monitor.(*baseMonitor).startSyncWrite()
      E:/workspace/gowork/src/github.com/no-src/gofs/monitor/base_monitor.go:120 +0x241
  github.com/no-src/gofs/monitor.(*fsNotifyMonitor).Start·dwrap·2()
      E:/workspace/gowork/src/github.com/no-src/gofs/monitor/fsnotify_monitor.go:97 +0x39

Goroutine 15 (running) created at:
  github.com/no-src/gofs/sync.(*remoteServerSync).start()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/remote_server_sync.go:209 +0x23b
  github.com/no-src/gofs/sync.NewRemoteServerSync()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/remote_server_sync.go:72 +0x6ce
  github.com/no-src/gofs/sync.NewRemoteSync()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/remote_sync.go:11 +0x164
  github.com/no-src/gofs/sync.NewSync()
      E:/workspace/gowork/src/github.com/no-src/gofs/sync/sync.go:36 +0x464
  main.main()
      E:/workspace/gowork/src/github.com/no-src/gofs/cmd/gofs/main.go:118 +0x10b9

Goroutine 20 (running) created at:
  github.com/no-src/gofs/monitor.(*fsNotifyMonitor).Start()
      E:/workspace/gowork/src/github.com/no-src/gofs/monitor/fsnotify_monitor.go:97 +0x377
  main.main()
      E:/workspace/gowork/src/github.com/no-src/gofs/cmd/gofs/main.go:157 +0x1631
==================
@mstmdev mstmdev added the race Data race label Jan 28, 2022
@mstmdev
Copy link
Member Author

mstmdev commented Jan 29, 2022

fixed by #11

@mstmdev mstmdev closed this as completed Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
race Data race
Projects
None yet
Development

No branches or pull requests

1 participant