Closed ccma14 closed 3 years ago
This PR resolves issue #39, which is a case that gets hit if a tile request is canceled while we are still processing the BeginTx call.
In that case nil is returned for tx (and err is non-nil) and we crash as described in #39.
nil
tx
err
This PR fixes the issue by exiting runQuery if BeginTx returns an error and removing the call to tx.Rollback altogether.
runQuery
BeginTx
tx.Rollback
Note that not calling tx.Rollback at all is OK because
database/sql.BeginTx
This implies that the transaction will always be rolled back without an explicit call to tx.Rollback.
Thanks to @audreyyku and @jerluc for their help with this!
Description
This PR resolves issue #39, which is a case that gets hit if a tile request is canceled while we are still processing the BeginTx call.
In that case
nil
is returned fortx
(anderr
is non-nil
) and we crash as described in #39.This PR fixes the issue by exiting
runQuery
ifBeginTx
returns an error and removing the call totx.Rollback
altogether.Note that not calling
tx.Rollback
at all is OK becausedatabase/sql.BeginTx
: If the context is canceled, the sql package will roll back the transaction.This implies that the transaction will always be rolled back without an explicit call to
tx.Rollback
.Thanks to @audreyyku and @jerluc for their help with this!