-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Commit
… drivers Previously we allowed drivers to modify the row buffer used to scan values when closing Rows. This is no longer acceptable and can lead to data races. Fixes #23519 Change-Id: I91820a6266ffe52f95f40bb47307d375727715af Reviewed-on: https://go-review.googlesource.com/89936 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -814,6 +814,13 @@ <h3 id="minor_library_changes">Minor changes to the library</h3> | |
<dl id="database/sql/driver"><dt><a href="/pkg/database/sql/driver/">database/sql/driver</a></dt> | ||
<dd> | ||
<p> | ||
Drivers that currently hold on to the destination buffer provdied by | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kardianos
Author
Contributor
|
||
<a href="/pkg/database/sql/driver/#Rows.Next"><code>driver.Rows.Next</code></a> should ensure they no longer | ||
write to a buffer assignedd to the destination array outside of that call. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
Drivers must be careful that underlying buffers are not modified when closing | ||
<a href="/pkg/database/sql/driver/#Rows"><code>driver.Rows</code></a>. | ||
</p> | ||
<p> | ||
Drivers that want to construct a <a href="/pkg/database/sql/#DB"><code>sql.DB</code></a> for | ||
their clients can now implement the <a href="/pkg/database/sql/driver/#Connector"><code>Connector</code></a> interface | ||
and call the new <a href="/pkg/database/sql/#OpenDB"><code>sql.OpenDB</code></a> function, | ||
|
4 comments
on commit 651ddbd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very disappointed by this change.
Why you can not wait calling driver.Rows.Close()
until application calls sql.Rows.Close()
or sql.Rows.Next()
?
For MySQL, cancelling query is heavy task and it is not implemented yet. There are no merit about hurry calling driver.Rows.Close()
even if it is implemented.
And we (go-sql-driver/mysql) didn't notice this change until Dec 2018.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to open a new issue rather than leaving comments here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where the code about ‘mc.buf.flip()’
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is reverted in Go 1.21.
#60304
typo: provided