Skip to content

fix: should wait for ringbuffer thread to finish before closing statement #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,15 @@ public ResultSet getResultSet() throws SQLException {
*/
public final void close() throws SQLException
{
if (connection.getQueryExecutor().isRingBufferThreadRunning() &&
(!connection.getAutoCommit() || getMaxRows() == 0))
{
// Wait for current ring buffer thread to finish, if any.
// Shouldn't call from synchronized method, which can cause dead-lock.
// We don't want to wait for ring buffer to fetch all rows if setMaxRows() is set,
// or if autoCommit is set to true
connection.getQueryExecutor().waitForRingBufferThreadToFinish(false, false, true, null, null);
}
if (RedshiftLogger.isEnable())
connection.getLogger().logFunction(true);

Expand Down