[Attempt to reopen an open cursor] in "Execute->Fetch->Cancel->Close->Execute->Fetch->Error" --------------------------------------------------------------------------------------------
Key: CORE-3984 URL: http://tracker.firebirdsql.org/browse/CORE-3984 Project: Firebird Core Issue Type: Bug Components: API / Client Library, Engine Affects Versions: 2.5.2 Environment: Win7, x64. Reporter: Kovalenko Dmitry 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] -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel