Ran
|
Files
10
|
Run time
2s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
<a href="https://github.com/mattn/go-sqlite3/commit/<a class=hub.com/mattn/go-sqlite3/commit/b3511bfdd742af558b54eb6160aca9446d762a19">b3511bfdd<a href="https://github.com/mattn/go-sqlite3/commit/b3511bfdd742af558b54eb6160aca9446d762a19">">Ensure that SqliteStmt.closed property is guarded. Because the closed property of the SQLiteRows&#39;s *SqliteStmt was not guarded, it was causing an issue during context cancellation. https://github.com/segmentio/go-sqlite3/blob/</a><a class="double-link" href="https://github.com/mattn/go-sqlite3/commit/<a class="double-link" href="https://git"><a class=</a>hub.com/mattn/go-sqlite3/commit/<a class=hub.com/mattn/go-sqlite3/commit/be424d27acde822f080bdcd8a7ae6abd4d7d801e">be424d27a">be424d27a</a><a href="https://github.com/mattn/go-sqlite3/commit/b3511bfdd742af558b54eb6160aca9446d762a19">/sqlite3.go#L1785-L1796 When a statement is performing a query(), if it determines that the context has been canceled, it will launch a goroutine that closes the resulting driver.Rows if it's not already completed. If the driver.Rows is not done (and the context has been canceled), it will interrupt the connection and more importantly, perform a rows.Close(). The method rows.Close() guards the closed bool with a sync.Mutex to set it to true. If a reader is reading from the SqliteRow, it will call Next() and that performs this check: https://github.com/segmentio/go-sqlite3/blob/be424d27acde822f080bdcd8a7ae6abd4d7d801e/sqlite3.go#L1915-L1917 Because this is not guarded, a data race ensues, and this was actually caught by the Go race detector recently. I didn't include a test case here because the fix seemed straightforward enough and because race conditions are hard to test for. It's been verified in another program that this fixes the issue. If tests should be provided I'm more than happy to do so.</a>
948 of 1639 relevant lines covered (57.84%)
62526.18 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|