Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 [CORE5075] #5362

Closed
firebird-automations opened this issue Jan 14, 2016 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Attachments:
console-output-when-run-on-fb-25-vs-30.zip

1. Create two databases, first on FB 2.5 and second on 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

Commits: 69afe4b d82e043 FirebirdSQL/fbt-repository@3ad0d35 FirebirdSQL/fbt-repository@e059341

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: console-output-when-run-on-fb-25-vs-30.zip [ 12871 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

=>

1. Create two databases, first on FB 2.5 and second on 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

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fix is committed

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 RC2 [ 10048 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants