Skip to content

First release

Pre-release
Pre-release
Compare
Choose a tag to compare
@denisenkom denisenkom released this 03 Nov 05:10
· 63 commits to master since this release
Disable logging in go routine

Logging was causing data race error.
Here is one example of such error (from https://ci.appveyor.com/project/denisenkom/go-mssqldb/builds/36105319/job/qrymmer7mnvkbv2p):
```
2020/11/03 03:32:09 initiating response reading
2020/11/03 03:32:09 got token tokenLoginAck
2020/11/03 03:32:09 got token tokenEnvChange
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=0
2020/11/03 03:32:09 response finished
2020/11/03 03:32:09
SET XACT_ABORT ON; -- 16384
SET ANSI_NULLS ON; -- 32
SET ARITHIGNORE ON; -- 128
2020/11/03 03:32:09 initiating response reading
2020/11/03 03:32:09 got token tokenEnvChange
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=1
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=1
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=0
2020/11/03 03:32:09 response finished
2020/11/03 03:32:09
select Options = @@OPTIONS;
2020/11/03 03:32:09 initiating response reading
2020/11/03 03:32:09 got token tokenColMetadata
2020/11/03 03:32:09 got token tokenRow
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=16
2020/11/03 03:32:09 (1 row(s) affected)
2020/11/03 03:32:09 response finished
2020/11/03 03:32:09
SET XACT_ABORT ON; -- 16384
SET ANSI_NULLS ON; -- 32
SET ARITHIGNORE ON; -- 128
2020/11/03 03:32:09 initiating response reading
2020/11/03 03:32:09 got token tokenEnvChange
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=1
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=1
2020/11/03 03:32:09 got token tokenDone
2020/11/03 03:32:09 got DONE or DONEPROC status=0
2020/11/03 03:32:09 response finished
==================
WARNING: DATA RACE
Read at 0x00c00033a043 by goroutine 55:
  testing.(*common).logDepth()
      c:/go113/src/testing/testing.go:665 +0xa8
  testing.(*common).Log()
      c:/go113/src/testing/testing.go:658 +0x7e
  github.com/denisenkom/go-mssqldb.testLogger.Println()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/tds_test.go:224 +0x5f
  github.com/denisenkom/go-mssqldb.optionalLogger.Println()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/log.go:26 +0xa1
  github.com/denisenkom/go-mssqldb.(*parseResp).dlog()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/token.go:708 +0x176
  github.com/denisenkom/go-mssqldb.(*parseResp).iter()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/token.go:725 +0xcc6
  github.com/denisenkom/go-mssqldb.processResponse()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/token.go:813 +0x17c
Previous write at 0x00c00033a043 by goroutine 40:
  testing.tRunner.func1()
      c:/go113/src/testing/testing.go:900 +0x35a
  testing.tRunner()
      c:/go113/src/testing/testing.go:913 +0x1c2
Goroutine 55 (running) created at:
  github.com/denisenkom/go-mssqldb.(*Stmt).processQueryResponse()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/mssql.go:600 +0x1a5
  github.com/denisenkom/go-mssqldb.(*Stmt).queryContext()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/mssql.go:594 +0x1c2
  github.com/denisenkom/go-mssqldb.(*Stmt).Query()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/mssql.go:584 +0xbe
  github.com/denisenkom/go-mssqldb.TestQueryCancelLowLevel()
      C:/gopath/src/github.com/denisenkom/go-mssqldb/queries_test.go:1805 +0x54c
  testing.tRunner()
      c:/go113/src/testing/testing.go:909 +0x1a0
Goroutine 40 (running) created at:
  testing.(*T).Run()
      c:/go113/src/testing/testing.go:960 +0x658
  testing.runTests.func1()
      c:/go113/src/testing/testing.go:1202 +0xad
  testing.tRunner()
      c:/go113/src/testing/testing.go:909 +0x1a0
  testing.runTests()
      c:/go113/src/testing/testing.go:1200 +0x528
  testing.(*M).Run()
      c:/go113/src/testing/testing.go:1117 +0x306
  main.main()
      _testmain.go:362 +0x33e
==================
2020/11/03 03:32:18 [{Hello} {World} {TVP}]
FAIL
coverage: 78.2% of statements
exit status 1
```

Testing data race

Testing data race

Testing data race

Testing data race

Testing data race

add comment