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

database/sql: data race #9715

Closed
bradfitz opened this issue Jan 28, 2015 · 2 comments
Closed

database/sql: data race #9715

bradfitz opened this issue Jan 28, 2015 · 2 comments
Assignees

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jan 28, 2015

Noticed on freebsd-amd64-race: http://build.golang.org/log/bfca7707a0ccb2dd15e8228eb5b97434c33d1143

WARNING: DATA RACE
Write by goroutine 71:
  database/sql.(*Stmt).Query()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1436 +0x6f3
  database/sql.func·039()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1957 +0x1ea
  testing.func·002()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:418 +0x18f

Previous read by goroutine 61:
  database/sql.(*Stmt).Query()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1435 +0x51f
  database/sql.func·039()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1957 +0x1ea
  testing.func·002()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:418 +0x18f
  runtime.goexit()
      /tmp/buildlet-scatch184358971/go/src/runtime/asm_amd64.s:2430 +0x0
  reflect.ValueOf()
      /tmp/buildlet-scatch184358971/go/src/reflect/value.go:2081 +0xfc
  database/sql/driver.int32Type.ConvertValue()
      /tmp/buildlet-scatch184358971/go/src/database/sql/driver/types.go:108 +0x80
  database/sql/driver.(*int32Type).ConvertValue()
      <autogenerated>:12 +0xf9
  database/sql.driverArgs()
      /tmp/buildlet-scatch184358971/go/src/database/sql/convert.go:68 +0xb3d
  database/sql.resultFromStatement()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1310 +0x372
  database/sql.(*Stmt).Exec()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1289 +0x31c
  database/sql.(*concurrentTxStmtExecTest).test()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1689 +0x1a0
  database/sql.func·035()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1750 +0xe2

Goroutine 71 (running) created at:
  testing.(*B).RunParallel()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:410 +0x46e
  database/sql.BenchmarkManyConcurrentQueries()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1964 +0x496
  testing.(*B).runN()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:124 +0xf2
  testing.(*B).launch()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:216 +0x1d0

Goroutine 61 (running) created at:
  testing.(*B).RunParallel()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:410 +0x46e
  database/sql.BenchmarkManyConcurrentQueries()
      /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1964 +0x496
  testing.(*B).runN()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:124 +0xf2
  testing.(*B).launch()
      /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:216 +0x1d0
==================
unexpected fault address 0x4c9c18
fatal error: fault
[signal 0xa code=0xc addr=0x4c9c18 pc=0x5bb9d8]

goroutine 431 [running]:
runtime.throw(0x44099f, 0x423c28)
    /tmp/buildlet-scatch184358971/go/src/runtime/panic.go:508 +0x98 fp=0x7fffff1f8e78 sp=0x7fffff1f8e60
runtime.goroutineheader(0x423c28)
    /tmp/buildlet-scatch184358971/go/src/runtime/traceback.go:586 +0x1c4 fp=0x7fffff1f8eb0 sp=0x7fffff1f8e78
runtime.dopanic_m(0xc2081377a0, 0x423c28, 0x7fffff1f8e60)
    /tmp/buildlet-scatch184358971/go/src/runtime/panic1.go:96 +0x1ca fp=0x7fffff1f8f08 sp=0x7fffff1f8eb0
runtime.func·045()
    /tmp/buildlet-scatch184358971/go/src/runtime/panic.go:495 +0x43 fp=0x7fffff1f8f28 sp=0x7fffff1f8f08
runtime.systemstack(0xc208013200)
    /tmp/buildlet-scatch184358971/go/src/runtime/asm_amd64.s:244 +0x71 fp=0x7fffff1f8f30 sp=0x7fffff1f8f28
runtime.mstart()
    /tmp/buildlet-scatch184358971/go/src/runtime/proc1.go:735 fp=0x7fffff1f8f38 sp=0x7fffff1f8f30
created by testing.(*B).RunParallel
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:419 +0x46e

goroutine 1 [chan receive]:
testing.(*B).run(0xc20807a200, 0x0, 0x0, 0x0, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:180 +0x91
testing.RunBenchmarks(0x6d1418, 0x784cc0, 0x9, 0x9)
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:312 +0x7ec
testing.(*M).Run(0xc20800a140, 0x7ace40)
    /tmp/buildlet-scatch184358971/go/src/testing/testing.go:495 +0x286
main.main()
    database/sql/_test/_testmain.go:158 +0x28d

goroutine 390 [semacquire]:
sync.runtime_Semacquire(0xc2080b0fcc)
    /tmp/buildlet-scatch184358971/go/src/runtime/sema.go:43 +0x2d
sync.(*Mutex).Lock(0xc2080b0fc8)
    /tmp/buildlet-scatch184358971/go/src/sync/mutex.go:66 +0xfd
database/sql.(*DB).removeDep(0xc2080b0fa0, 0x8007da350, 0xc2081f2000, 0x63bdc0, 0xc208178f00, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:392 +0x5b
database/sql.func·009(0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1438 +0x13e
database/sql.(*Rows).Close(0xc208178f00, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1650 +0x201
database/sql.func·039(0xc2080d4000)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1962 +0x322
testing.func·002()
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:418 +0x190
created by testing.(*B).RunParallel
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:419 +0x46e

goroutine 418 [semacquire]:
sync.runtime_Semacquire(0xc2080b0fcc)
    /tmp/buildlet-scatch184358971/go/src/runtime/sema.go:43 +0x2d
sync.(*Mutex).Lock(0xc2080b0fc8)
    /tmp/buildlet-scatch184358971/go/src/sync/mutex.go:66 +0xfd
database/sql.(*DB).putConn(0xc2080b0fa0, 0xc208069740, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:721 +0x54
database/sql.(*driverConn).releaseConn(0xc208069740, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:258 +0x60
database/sql.*driverConn.(database/sql.releaseConn)·fm(0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:908 +0x49
database/sql.func·009(0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1437 +0x7d
database/sql.(*Rows).Close(0xc2080a7860, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1650 +0x201
database/sql.func·039(0xc2080d4a60)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1962 +0x322
testing.func·002()
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:418 +0x190
created by testing.(*B).RunParallel
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:419 +0x46e

goroutine 340 [semacquire]:
sync.runtime_Semacquire(0xc2080b0fcc)
    /tmp/buildlet-scatch184358971/go/src/runtime/sema.go:43 +0x2d
sync.(*Mutex).Lock(0xc2080b0fc8)
    /tmp/buildlet-scatch184358971/go/src/sync/mutex.go:66 +0xfd
database/sql.(*DB).putConn(0xc2080b0fa0, 0xc208069680, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:721 +0x54
database/sql.(*driverConn).releaseConn(0xc208069680, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:258 +0x60
database/sql.*driverConn.(database/sql.releaseConn)·fm(0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:908 +0x49
database/sql.func·009(0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1437 +0x7d
database/sql.(*Rows).Close(0xc2081e88a0, 0x0, 0x0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql.go:1650 +0x201
database/sql.func·039(0xc2081a41a0)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1962 +0x322
testing.func·002()
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:418 +0x190
created by testing.(*B).RunParallel
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:419 +0x46e

goroutine 205 [semacquire]:
sync.runtime_Semacquire(0xc20802a060)
    /tmp/buildlet-scatch184358971/go/src/runtime/sema.go:43 +0x2d
sync.(*WaitGroup).Wait(0xc20804c600)
    /tmp/buildlet-scatch184358971/go/src/sync/waitgroup.go:132 +0x1e8
testing.(*B).RunParallel(0xc20807a200, 0xc20804c5c0)
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:421 +0x497
database/sql.BenchmarkManyConcurrentQueries(0xc20807a200)
    /tmp/buildlet-scatch184358971/go/src/database/sql/sql_test.go:1964 +0x497
testing.(*B).runN(0xc20807a200, 0x3e8)
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:124 +0xf3
testing.(*B).launch(0xc20807a200)
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:216 +0x1d1
created by testing.(*B).run
    /tmp/buildlet-scatch184358971/go/src/testing/benchmark.go:179 +0x57

@bradfitz bradfitz self-assigned this Jan 28, 2015
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jan 28, 2015

/cc @dvyukov as FYI

@methane
Copy link
Contributor

@methane methane commented Jan 29, 2015

#9716 is duplicate of this issue and discussion has been started already on it.

@bradfitz bradfitz closed this Jan 29, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.