Issue Details (XML | Word | Printable)

Key: CORE-3984
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Kovalenko Dmitry
Votes: 0
Watchers: 2
Operations

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

[Attempt to reopen an open cursor] in "Execute->Fetch->Cancel->Close->Execute->Fetch->Error"

Created: 16/Nov/12 09:59 AM   Updated: 05/Feb/16 09:43 AM
Component/s: API / Client Library, Engine
Affects Version/s: 2.5.2
Fix Version/s: None

Environment: Win7, x64.


 Description  « Hide
Server Version :2.5.3.26543 [Windows, SuperClassic, 64bit]
Client Version :2.5.3.26543 [Windows, 32bit]
Database ODS :11.2
Database Dialect:3

Connection through "localhost".

Work from 32bit application.

-----------------------------------------------
Common scenario:
1. thread1: execute statement "select ID,DUMMY from SP_PAUSE_FETCH(1000,10000000)"
2. thread2: fetch one row
3. thread1: cancel fetch (and wait the finish of cancelation)
4. thread1: close cursor
5. thread1: execute statment again
6. thread2: fetch one row -> ERROR "Attempt to reopen an open cursor"

-----------------------------------------------
Sequence of ISC API calls:
    11:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000001]: isc_dsql_allocate_statement(...,db_handle=&00000002,stmt_handle=&00000000)
    12:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000001]: isc_dsql_allocate_statement(...,db_handle=&00000002,stmt_handle=&00000004) return OK.
    13:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000002]: isc_dsql_prepare(...,tr_handle=&00000003,stmt_handle=&00000004,...)
[stmt_text len:50]
select ID,DUMMY from SP_PAUSE_FETCH(1000,10000000)
[/stmt_text]
    14:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000002]: isc_dsql_prepare(...,tr_handle=&00000003,stmt_handle=&00000004,...) return OK.
    15:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000003]: isc_dsql_execute2(...,tr_handle=&00000003,stmt_handle=&00000004,...)
    16:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000003]: isc_dsql_execute2(...,tr_handle=&00000003,stmt_handle=&00000004,...) return OK.
    17:[Thr 2284][16.11.2012 12:51:57]ISC_API_IN [#000004]: isc_dsql_fetch(...,stmt_handle=&00000004,...)
    18:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000005]: fb_cancel_operation(,db_handle=&00000002,option=3)
    19:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000005]: fb_cancel_operation(,db_handle=&00000002,option=3) return OK.
    20:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000006]: fb_cancel_operation(,db_handle=&00000002,option=3)
    21:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000006]: fb_cancel_operation(,db_handle=&00000002,option=3) return OK.
    22:[Thr 2284][16.11.2012 12:51:57]ISC_API_OUT[#000004]: isc_dsql_fetch(...,stmt_handle=&00000004,...) return ERROR [335544794]
operation was cancelled
    23:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000007]: isc_dsql_free_statement(...,stmt_handle=&00000004,1)
    24:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000007]: isc_dsql_free_statement(...,stmt_handle=&00000004,1) return OK.
    25:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000008]: isc_dsql_execute2(...,tr_handle=&00000003,stmt_handle=&00000004,...)
    26:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000008]: isc_dsql_execute2(...,tr_handle=&00000003,stmt_handle=&00000004,...) return OK.
    27:[Thr 2284][16.11.2012 12:51:57]ISC_API_IN [#000009]: isc_dsql_fetch(...,stmt_handle=&00000004,...)
    28:[Thr 2284][16.11.2012 12:51:57]ISC_API_OUT[#000009]: isc_dsql_fetch(...,stmt_handle=&00000004,...) return ERROR [335544569]
Dynamic SQL Error
SQL error code = -502
Attempt to reopen an open cursor
    29:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000010]: isc_dsql_free_statement(...,stmt_handle=&00000004,1)
    30:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000010]: isc_dsql_free_statement(...,stmt_handle=&00000004,1) return OK.
    31:[Thr 10032][16.11.2012 12:51:57]ISC_API_IN [#000011]: isc_dsql_free_statement(...,stmt_handle=&00000004,2)
    32:[Thr 10032][16.11.2012 12:51:57]ISC_API_OUT[#000011]: isc_dsql_free_statement(...,stmt_handle=&00000000,2) return OK.

-------------
In line 23-24 I close my open cursor
In line 25-26 I re-execute statement

Why in line 28 (operation #000009) I obtain the error "Attempt to reopen an open cursor" ?

---------- [Test stored procedure]
CREATE PROCEDURE SP_PAUSE_FETCH(N INTEGER, PAUSE INTEGER)
 RETURNS (ID INTEGER,DUMMY VARCHAR(32000))
AS
 DECLARE VARIABLE P INTEGER;
 DECLARE VARIABLE S INTEGER;
BEGIN
 ID=0;

 DUMMY='';
 P=0;
 WHILE(P<32000)DO
 BEGIN
  DUMMY=DUMMY||'A';
  P=P+1;
 END

 S=0;
 WHILE(S=0)DO
 BEGIN
  P=0;
  WHILE(P<PAUSE) DO P=P+1;

  IF(ID<N)THEN
  BEGIN
   ID=ID+1;
   SUSPEND;
  END
  ELSE
  BEGIN
   S=1;
  END
 END
END
---------- [/Test stored procedure]


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.