Connection that was created by ES/EDS remains alive after it successfully kills 
its "parent" connection and disconnect from database
------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4790
                 URL: http://tracker.firebirdsql.org/browse/CORE-4790
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
            Reporter: Pavel Zotov
            Priority: Minor
         Attachments: trace-when-child-attach-kills-his-parent.zip

Step 1. Prepare empty database, restart FB service
=====

Step 2. Launch isql and run there (using 'IN' command) tollowing script:
=====
create or alter procedure sp_test(a_parent_att int) as begin end;
recreate table log(att_id int default current_connection, dts timestamp default 
'now');
commit;

set term ^;
create or alter procedure sp_test(a_parent_att int) as
begin
  in autonomous transaction do
  insert into log default values;

  execute statement ('delete from mon$attachments where mon$attachment_id = ?') 
(a_parent_att)
  on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
  with autonomous transaction
  as user 'sysdba' password 'masterke' role 'R002'
  ;
end
^
set term ;^
commit;


set list on;

set term ^;
execute block as
begin
  execute statement 'execute procedure sp_test(' || current_connection || ')'
  on external 'localhost:' || rdb$get_context('SYSTEM','DB_NAME')
  with autonomous transaction
  as user 'sysdba' password 'masterke' role 'R001'
  ;
end
^
set term ^;

quit;
=====

After running this script you'll get in STDERR:

=====
Statement failed, SQLSTATE = 42000
Execute statement error at isc_dsql_execute2 :
335544921 : Execute statement error at transaction commit :
335544794 : operation was cancelled
Data source : Firebird::localhost:C:\MIX\firebird\QA\fbt-repo\tmp\e30.fdb
335544842 : At procedure 'SP_TEST' line: 6, col: 3
Statement : execute procedure sp_test(19)
Data source : Firebird::localhost:C:\MIX\firebird\QA\fbt-repo\tmp\e30.fdb
-Execute statement error at transaction rollback :
335544794 : operation was cancelled
Data source : Firebird::localhost:C:\MIX\firebird\QA\fbt-repo\tmp\e30.fdb
-Execute statement error at detach :
335544357 : cannot disconnect database with open transactions (1 active)
Data source : Firebird::localhost:C:\MIX\firebird\QA\fbt-repo\tmp\e30.fdb
=====

-- and return to command prompt.

Step 3
=====

After returning in command prompt do several times:

C:\MIX\firebird\QA\fbt-repo\tmp>isql localhost/3333:e30
Database:  localhost/3333:e30
SQL> select current_connection, mon$attachment_id from mon$attachments 
CON> where mon$remote_address is not null and 
mon$attachment_id<>current_connection;

CURRENT_CONNECTION MON$ATTACHMENT_ID
================== =================
                11                 9

SQL> quit;

C:\MIX\firebird\QA\fbt-repo\tmp>isql localhost/3333:e30
Database:  localhost/3333:e30
SQL> select current_connection, mon$attachment_id from mon$attachments 
CON> where mon$remote_address is not null and 
mon$attachment_id<>current_connection;

CURRENT_CONNECTION MON$ATTACHMENT_ID
================== =================
                12                 9

SQL> quit;

C:\MIX\firebird\QA\fbt-repo\tmp>isql localhost/3333:e30
Database:  localhost/3333:e30
SQL> select current_connection, mon$attachment_id from mon$attachments 
CON> where mon$remote_address is not null and 
mon$attachment_id<>current_connection;

CURRENT_CONNECTION MON$ATTACHMENT_ID
================== =================
                13                 9

Connection # 9 repeats every time in output - it had to be removed together 
with his 'parent' attach (which did this:   execute statement 'execute 
procedure sp_test(' || current_connection || ')' ... )

FB service after step-2 can`t be stopped via Services applet (only cab be 
killed in ProcessExplorer), firebird.log will contain:
===
CSPROG  Wed May 13 20:11:00 2015
        Shutting down the server with 1 active connection(s) to 1 database(s), 
1 active service(s)
===

Trace after "Step 2" please see in attach.

PS. This is totally artificial test, I can`t  imagine how this can occur in 
real practice. But all attachments should be deleted - no matter how they were 
created (IMO).

-- 
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

        

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to