Open jpa-rocha opened 3 months ago
My understanding is that the variables assigned within the two added sync.Mutex.Lock regions in the function readRecordSet are assigned only within their respective threads. Can you please explain which variables and what kind of data race occurs?
Hi thanks for getting back to me. It seems the problem is the pos variable that is declared in the readRecordSet function, and then accessed by the 2 go functions in it.
WARNING: DATA RACE
Read at 0x00c0001da838 by goroutine 17:
github.com/mithrandie/csvq/lib/query.readRecordSet.func1()
/home/jrocha/kerouac/vendor/github.com/mithrandie/csvq/lib/query/load_view.go:1343 +0x1f9
Previous write at 0x00c0001da838 by goroutine 18:
github.com/mithrandie/csvq/lib/query.readRecordSet.func2()
/home/jrocha/kerouac/vendor/github.com/mithrandie/csvq/lib/query/load_view.go:1392 +0x4c4
In our tests, when the file opened only has one entry the data race doesnt happen, but more than one will trigger it.
fixed data races in our tests