Skip to content

race with multiple clients on same connection #35

@mbucc

Description

@mbucc

When I tried creating multiple clients on the same connection, I got the data race below.

% go test -race -run TestServer
Server is up, got connnection &{conn:{fd:0xc2080103f0}}
..==================
WARNING: DATA RACE
Write by goroutine 5:
  github.com/lionkov/go9p/p/clnt.(*Clnt).ReqFree()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:446 +0xe6
  github.com/lionkov/go9p/p/clnt.(*Clnt).Rpc()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:149 +0x1c3
  github.com/lionkov/go9p/p/clnt.Connect()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:386 +0x245
  github.com/lionkov/go9p/p/clnt.MountConn()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/mount.go:75 +0x6a
  github.com/mbucc/vufs.listDir()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:84 +0xc1
  github.com/mbucc/vufs.func·007()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:146 +0x114
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·002()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:163 +0xbc
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.mark1()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:23 +0x3f
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:72 +0x93
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.(*context).Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:164 +0x602
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:77 +0x7b
  github.com/mbucc/vufs.func·010()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:149 +0x499
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·001()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x27a
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.rootConvey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:113 +0x626
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:75 +0x59
  github.com/mbucc/vufs.TestServer()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:165 +0x99b
  testing.tRunner()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:447 +0x133

Previous read by goroutine 17:
  github.com/lionkov/go9p/p/clnt.(*Clnt).recv()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:273 +0x7b8

Goroutine 5 (running) created at:
  testing.RunTests()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:555 +0xd4e
  testing.(*M).Run()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:485 +0xe0
  main.main()
      github.com/mbucc/vufs/_test/_testmain.go:56 +0x28c

Goroutine 17 (finished) created at:
  github.com/lionkov/go9p/p/clnt.NewClnt()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:348 +0x573
  github.com/lionkov/go9p/p/clnt.Connect()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:373 +0x7f
  github.com/lionkov/go9p/p/clnt.MountConn()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/mount.go:75 +0x6a
  github.com/mbucc/vufs.listDir()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:84 +0xc1
  github.com/mbucc/vufs.func·007()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:146 +0x114
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·002()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:163 +0xbc
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.mark1()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:23 +0x3f
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:72 +0x93
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.(*context).Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:164 +0x602
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:77 +0x7b
  github.com/mbucc/vufs.func·010()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:149 +0x499
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·001()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x27a
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.rootConvey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:113 +0x626
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:75 +0x59
  github.com/mbucc/vufs.TestServer()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:165 +0x99b
  testing.tRunner()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:447 +0x133
==================
x==================
WARNING: DATA RACE
Write by goroutine 5:
  github.com/lionkov/go9p/p/clnt.(*Clnt).ReqFree()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:446 +0xe6
  github.com/lionkov/go9p/p/clnt.(*Clnt).Rpc()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:149 +0x1c3
  github.com/lionkov/go9p/p/clnt.Connect()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:386 +0x245
  github.com/lionkov/go9p/p/clnt.MountConn()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/mount.go:75 +0x6a
  github.com/mbucc/vufs.listDir()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:84 +0xc1
  github.com/mbucc/vufs.func·008()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:153 +0x102
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·002()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:163 +0xbc
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.mark1()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:23 +0x3f
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:72 +0x93
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.(*context).Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:164 +0x602
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:77 +0x7b
  github.com/mbucc/vufs.func·010()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:155 +0x6c2
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·001()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x27a
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:77 +0x7b
  github.com/mbucc/vufs.func·010()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:149 +0x499
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·001()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x27a
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.rootConvey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:113 +0x626
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:75 +0x59
  github.com/mbucc/vufs.TestServer()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:165 +0x99b
  testing.tRunner()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:447 +0x133

Previous read by goroutine 19:
  github.com/lionkov/go9p/p/clnt.(*Clnt).recv()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:273 +0x7b8

Goroutine 5 (running) created at:
  testing.RunTests()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:555 +0xd4e
  testing.(*M).Run()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:485 +0xe0
  main.main()
      github.com/mbucc/vufs/_test/_testmain.go:56 +0x28c

Goroutine 19 (finished) created at:
  github.com/lionkov/go9p/p/clnt.NewClnt()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:348 +0x573
  github.com/lionkov/go9p/p/clnt.Connect()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/clnt.go:373 +0x7f
  github.com/lionkov/go9p/p/clnt.MountConn()
      /Users/mark/go/src/github.com/lionkov/go9p/p/clnt/mount.go:75 +0x6a
  github.com/mbucc/vufs.listDir()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:84 +0xc1
  github.com/mbucc/vufs.func·008()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:153 +0x102
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·002()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:163 +0xbc
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.mark1()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:23 +0x3f
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:72 +0x93
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.(*context).Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:164 +0x602
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:77 +0x7b
  github.com/mbucc/vufs.func·010()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:155 +0x6c2
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·001()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x27a
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:77 +0x7b
  github.com/mbucc/vufs.func·010()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:149 +0x499
  github.com/smartystreets/goconvey/convey.func·006()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x46
  github.com/smartystreets/goconvey/convey.(*context).conveyInner()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x387
  github.com/smartystreets/goconvey/convey.func·001()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x27a
  github.com/jtolds/gls._m()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x3c
  github.com/jtolds/gls.markS()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x3f
  github.com/jtolds/gls.addStackTag()
      /Users/mark/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x50
  github.com/jtolds/gls.(*ContextManager).SetValues()
      /Users/mark/go/src/github.com/jtolds/gls/context.go:98 +0x665
  github.com/smartystreets/goconvey/convey.rootConvey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/context.go:113 +0x626
  github.com/smartystreets/goconvey/convey.Convey()
      /Users/mark/go/src/github.com/smartystreets/goconvey/convey/doc.go:75 +0x59
  github.com/mbucc/vufs.TestServer()
      /Users/mark/go/src/github.com/mbucc/vufs/vufs_test.go:165 +0x99b
  testing.tRunner()
      /usr/local/Cellar/go/1.4.2/libexec/src/testing/testing.go:447 +0x133
==================

To reproduce, something like this should work:

go get github.com/mbucc/vufs
cd src/github.com/mbucc/vufs
git checkout 78465d11fd6dc0a858b701184d920c64d77429d0
go test -race -run TestServer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions