Describe the bug
Running $ go test ./... -race results in a data race. See stack trace below. The issue seems to happen when func (r *tdsBuffer) readNextPacket() is writing to a field of the tdsBuffer instance .
During the transaction there are two insert statements happening
The database is running in a docker container with base image from mcr.microsoft.com/mssql/server:2022-latestSELECT @@VERSION; shows
Microsoft SQL Server 2022 (RTM-CU5) (KB5026806) - 16.0.4045.3 (X64)
May 26 2023 12:52:08
Copyright (C) 2022 Microsoft Corporation
Developer Edition (64-bit) on Linux (Ubuntu 20.04.6 LTS) <X64>
I cannot completely rule out that i am doing something wrong, but since I am not using go routines in my part of the code it seems more likely that it might indeed be an issue inside the go-mssqldb package.
Versions
go 1.21
github.com/microsoft/go-mssqldb v1.6.0
Describe the bug Running
$ go test ./... -race
results in a data race. See stack trace below. The issue seems to happen whenfunc (r *tdsBuffer) readNextPacket()
is writing to a field of the tdsBuffer instance .During the transaction there are two insert statements happening
and later this is called
Edit: I just noticed the data race does not occur when there is no OUTPUT field in the NamedQuery. With the following query there is no data race:
Stack trace:
Further technical details
The database is running in a docker container with base image from
mcr.microsoft.com/mssql/server:2022-latest
SELECT @@VERSION;
showsI cannot completely rule out that i am doing something wrong, but since I am not using go routines in my part of the code it seems more likely that it might indeed be an issue inside the go-mssqldb package.