Issue Details (XML | Word | Printable)

Key: CORE-4313
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: Alexander Potapchenko
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird Core

Error "Attempt to reopen an open cursor" may be raised if the query handle is reused in a different transaction

Created: 05/Jan/14 04:22 PM   Updated: 18/Jan/16 03:32 PM
Component/s: Engine
Affects Version/s: 3.0 Alpha 1, 3.0 Alpha 2
Fix Version/s: 3.0 Beta 1

QA Status: No test

 Description  « Hide
Call sequence that demonstrates the issue:

isc_dsql_allocate_statement(status, &db, &st);
isc_start_transaction(status, &tr, 1, &db, 0, NULL);
isc_dsql_prepare(status, &tr, &st, 0, "select 1 from rdb$relations", 1, sqlda);

isc_dsql_execute(status, &tr, &st, 1, NULL);
while (isc_dsql_fetch(status, &st, 1, sqlda) == 0);

isc_commit_transaction(status, &tr);
isc_start_transaction(status, &tr, 1, &db, 0, NULL);

isc_dsql_free_statement(status, &st, DSQL_close);

-- here error is raised
isc_dsql_execute(status, &tr, &st, 1, NULL);
while (isc_dsql_fetch(status, &st, 1, sqlda) == 0);

isc_dsql_free_statement(status, &st, DSQL_drop);
isc_commit_transaction(status, &tr);

The issue is caused by the cursor not being explicitly closed before transaction commit/rollback. It worked in prior versions, but in v3.0 this sequence leads to leftover cursor pointers causing the error to be thrown.

P.S. Given the known details, I'm not sure it's the same issue as CORE-3984.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dimitry Sibiryakov added a comment - 05/Jan/14 06:58 PM
Shouldn't be error raised earlier, on attempt to close already closed cursor?..

Dmitry Yemanov added a comment - 05/Jan/14 07:11 PM
Yes, but it can be ignored by driver / application.