Regression. Triger on DISCONNECT with dynamic SQL (ES 'insert into ...'): 1) 
does not work in 3.0; 2) leads FB to crash when it is recreated
--------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-5075
                 URL: http://tracker.firebirdsql.org/browse/CORE-5075
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0 RC1
            Reporter: Pavel Zotov
         Attachments: console-output-when-run-on-fb-25-vs-30.zip

1. Create two databases, on in FB 2.5 and second in FB 3.0, and assign aliases 
for them; in following example these aliases are: 'e25' and 'e30'.
2. Create script (let's with name = 'ct.sql'):
===
set bail on;

set term ^;
create or alter trigger trg_connect active on connect position 0 as
begin
end
^

create or alter trigger trg_disc active on disconnect position 0 as
begin
end
^
set term ;^
commit;


recreate table log(what_happened  varchar(20), when_it_was timestamp default 
'now');
commit;


set term ^;

execute block as
begin
    rdb$set_context('USER_SESSION','INITIAL_DDL','1');
end
^

create or alter trigger trg_connect active on connect position 0 as
begin
    execute statement 'insert into log(what_happened) values(''connect'')'
    with autonomous transaction;
end
^

create or alter trigger trg_disc active on disconnect position 0 as
begin
    if ( rdb$get_context('USER_SESSION','INITIAL_DDL') is null ) then
        execute statement 'insert into log(what_happened) 
values(''disconnect'')'
        with autonomous transaction;
end
^
set term ;^
commit;

set echo on;

show table log;

show trigger;
quit;
===

3. Run following sequence of commands:

3.1. For working with FB 2.5 that is listening to the port = 3255:
===
%FB25_BIN%\isql /3255:e25 -i ct.sql
echo set count on; select * from log; | %FB25_BIN%\isql /3255:e25
echo set count on; select * from log; | %FB25_BIN%\isql /3255:e25
echo set count on; select * from log; | %FB25_BIN%\isql /3255:e25
%FB25_BIN%\isql /3255:e25 -i ct.sql
echo set count on; select * from log; | %FB25_BIN%\isql /3255:e25
===

3.2. For working with FB 3.0 that is listening to the port = 3333:
===
%FB30_BIN%\isql /3333:e30 -i ct.sql
echo set count on; select * from log; | %FB30_BIN%\isql /3333:e30
echo set count on; select * from log; | %FB30_BIN%\isql /3333:e30
echo set count on; select * from log; | %FB30_BIN%\isql /3333:e30
%FB30_BIN%\isql /3333:e30 -i ct.sql 
-------------------------------------------------------------------- [!!!]
echo set count on; select * from log; | %FB30_BIN%\isql /3333:e30
===

Output in 3.0 differs from 2.5:
1) 'disconnect' event is NOT written into log (and exactly because of ES, i.e. 
dynamic SQL; when 'insert' statement is written as static statement in trigger 
body - no problem);
2) FB 3.0 will crash after DDL script ('ct.sql') will be executes 2nd time - 
see marked line "[!!!]"; console will contain: Statement failed, SQLSTATE = 
08006 / Error reading data from the connection;  firebird.log will contain:
===
CSPROG  Thu Jan 14 23:11:34 2016
         Access violation.
                The code attempted to access a virtual
                address without privilege to do so.
        This exception will cause the Firebird server
        to terminate abnormally.


CSPROG  Thu Jan 14 23:11:34 2016
        INET/inet_error: read errno = 10054, server host = csprog, address = 
192.168.43.154/3333
===

Both logs of output see in attached file.

PS. WI-V3.0.0.32272

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

        

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to