AV after second issuing of: 'commit; delete from mon$statements;' when bulk of
DDLs are executing in another ISQL session
--------------------------------------------------------------------------------------------------------------------------
Key: CORE-4741
URL: http://tracker.firebirdsql.org/browse/CORE-4741
Project: Firebird Core
Issue Type: Bug
Reporter: Pavel Zotov
Attachments:
firebird-crash-after-2nd-issuing-delete-from-monstatements-under-heavy-DDL-work.zip
Environment:
OS: Windows XP SP3
Firebird: WI-T3.0.0.31780, SuperServer
Work is done under cmd.exe (not FAR, Total Commander or similar shells).
Database is empty before test:
Database "C:\MIX\firebird\QA\fbt-repo\tmp\e30.fdb"
Database header page information:
Flags 0
Generation 60
System Change Number 0
Page size 4096
ODS version 12.0
Oldest transaction 13
Oldest active 14
Oldest snapshot 14
Next transaction 53
Sequence number 0
Next attachment ID 15
Implementation HW=Intel/i386 little-endian OS=Windows CC=MSVC
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Mar 11, 2015 21:45:02
Attributes
Variable header data:
*END*
WINDOW-1:
=========
C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb30\isql.exe localhost/3333:e30
Database: localhost/3333:e30
WINDOW-2:
==========
C:\MIX\firebird\fb30\isql.exe localhost/3333:e30 -i c2933.sql
-- where script `c2933.sql` is:
------------------------ start of c2933.sql ---------------------
recreate global temporary table gtt_log(iter_no int, action_type varchar(20),
elap_ms int) on commit delete rows;
recreate table ddl_log(iter_no int, action_type varchar(20), elap_ms int);
commit;
set list on;
select current_timestamp as "start_time" from rdb$database;
commit;
set transaction read committed no record_version wait;
set term ^;
execute block as
declare n int;
declare m int = 100; -- number of iterations (each includes: create proc,
create view, drop view, drop proc);
declare i int;
declare v_ia int = 200; -- number of inp args
declare v_oa int = 200; -- number of out args
declare v_stt_ia varchar(31760);
declare v_stt_oa varchar(31760);
declare v_nul_ia varchar(31760);
declare v_add_fn varchar(31760);
declare v_kil_fn varchar(31760);
declare v_stt varchar(31760);
declare t0 timestamp;
declare t1 timestamp;
declare t2 timestamp;
declare t3 timestamp;
declare t4 timestamp;
declare t5 timestamp;
declare t6 timestamp;
begin
v_stt_ia=' (';
v_nul_ia=' (';
v_kil_fn=' ';
v_add_fn=' ';
i=1;
while (i<v_ia) do
begin
v_stt_ia = v_stt_ia || iif(i>1, ascii_char(10)||',', '') || 'inp_' || i ||
' varchar(10) character set utf8';
v_nul_ia = v_nul_ia || iif(i>1, ',', '') || 'null';
v_kil_fn = v_kil_fn || iif(i>1, ',', '') || 'drop inp_' || i;
v_add_fn = v_add_fn || iif(i>1, ',', '') || 'add out_' || i || '
varchar(10) character set utf8';
i = i+1;
end
v_stt_ia = v_stt_ia || ')';
v_nul_ia = v_nul_ia || ')';
--v_kil_fn = v_kil_fn || ';'
--v_add_fn = v_add_fn || ';'
v_stt_oa='returns (';
i=1;
while (i<v_oa) do
begin
v_stt_oa = v_stt_oa || iif(i>1, ascii_char(10)||',', '') || 'out_' || i ||
' varchar(10) character set utf8';
i = i+1;
end
v_stt_oa = v_stt_oa || ')';
n = 1;
while ( n <= m ) do
begin
t0=cast('now' as timestamp);
execute statement( 'create or alter procedure sp_' || n || v_stt_ia ||
ascii_char(10) || v_stt_oa || ' as ' || ascii_char(10) || 'begin suspend; end'
) with autonomous transaction;
t1=cast('now' as timestamp);
--execute statement( 'create or alter view v_'|| n || ' as select * from
sp_' || n || v_nul_ia ) with autonomous transaction;
execute statement( 'create table t_'|| n || v_stt_ia ) with autonomous
transaction;
t2=cast('now' as timestamp);
execute statement( 'alter table t_' || n || v_add_fn || ', ' || v_kil_fn
) with autonomous transaction;
t3=cast('now' as timestamp);
execute statement( 'alter procedure sp_' || n || v_stt_ia ||
ascii_char(10) || v_stt_oa || ' as ' || ascii_char(10) || 'declare i
int;'||ascii_char(10)||'begin suspend; end' ) with autonomous transaction;
t4=cast('now' as timestamp);
execute statement( 'drop procedure sp_' || n ) with autonomous
transaction;
t5=cast('now' as timestamp);
execute statement( 'drop table t_' || n ) with autonomous transaction;
t6=cast('now' as timestamp);
insert into gtt_log(iter_no, action_type, elap_ms) values( :n,
'create_proc', datediff(millisecond from :t0 to :t1) );
insert into gtt_log(iter_no, action_type, elap_ms) values( :n,
'create_table', datediff(millisecond from :t1 to :t2) );
insert into gtt_log(iter_no, action_type, elap_ms) values( :n, 'alter
table', datediff(millisecond from :t2 to :t3) );
insert into gtt_log(iter_no, action_type, elap_ms) values( :n,
'alter_proc', datediff(millisecond from :t3 to :t4) );
insert into gtt_log(iter_no, action_type, elap_ms) values( :n,
'drop_proc', datediff(millisecond from :t4 to :t5) );
insert into gtt_log(iter_no, action_type, elap_ms) values( :n,
'drop_table', datediff(millisecond from :t5 to :t6) );
n = n + 1;
end
end
^
set term ;^
insert into ddl_log select * from gtt_log;
commit;
select current_timestamp as "finish_time" from rdb$database;
select action_type, min(elap_ms) min_ms, max(elap_ms) max_ms
from ddl_log
group by 1;
---------------------------- end of c2933.sql -------------------------
After WINDOW-2 starts doing work during ~1 minute, switch to WINDOW-1 and do
there:
SQL> commit; delete from mon$statements; -- (1)
SQL> commit; delete from mon$statements; -- (2)
After issuing 2nd command:
1) message about Firebird crash appears on the screen with content:
------ russian --------
Firebird SQL Server - обнаружена ошибка. Приложение будет закрыто. Приносим
извинения за неудобства.
Подпись ошибки:
szAppName : firebird.exe szAppVer : 3.0.0.31780 szModName : engine12.dll
szModVer : 3.0.0.31780 offset : 0019f794
C:\TEMP\WER4585.dir00\firebird.exe.mdmp
C:\TEMP\WER4585.dir00\appcompat.txt
--------------------------
2) message about AV appears in firebird.log:
--------------
CSPROG Wed Apr 08 19:13:27 2015
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 Wed Apr 08 19:14:54 2015
Shutting down the server with 2 active connection(s) to 1 database(s),
0 active service(s)
--------------
Files that are mentioned in the windows message (firebird.exe.mdmp &
appcompat.txt) please see in attach.
--
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
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel