2 @message |
AssertionError: assert
rdb_trg_name TRG_ATTACH
rdb_trg_type 8192
rdb_trg_name TRG_DETACH
rdb_trg_type 8193
Error at disconnect:
Execute statement error
335544830 : Too many recursion levels of EXECUTE STATEMENT
Data source : Firebird::
At trigger 'TRG_DETACH'
Error at disconnect:
Execute statement error
- 335544830 : Too many recursion levels of EXECUTE STATEMENT
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 3
Data source : Firebird::
At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 4
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 6
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 8
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 9
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 10
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 11
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
+ Error at disconnect:
+ Execute statement error
+ 335544517 : exception 1
+ 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 12
+ Data source : Firebird::
+ At trigger 'TRG_DETACH'
LOG DETAILS:
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 act = <firebird.qa.plugin.Action object at [hex]>
2024-06-11 09:15:19.554 tmp_sql = WindowsPath('R:/temp/qa/fbqa/test_11559/tmp_8077.sql')
2024-06-11 09:15:19.554 tmp_log = WindowsPath('R:/temp/qa/fbqa/test_11559/tmp_8077.log')
2024-06-11 09:15:19.554 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 @pytest.mark.es_eds
2024-06-11 09:15:19.554 @pytest.mark.version('>=4.0.5')
2024-06-11 09:15:19.554 def test_1(act: Action, tmp_sql: Path, tmp_log: Path, capsys):
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 test_sql = f"""
2024-06-11 09:15:19.554 set list on;
2024-06-11 09:15:19.554 set bail on;
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 set term ^;
2024-06-11 09:15:19.554 create or alter trigger trg_detach on disconnect as begin end
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create or alter trigger trg_attach on connect as begin end
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create sequence g_attach
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create sequence g_detach
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create sequence g_diff
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create exception exc_too_deep_recursion 'Execution terminated by @1: recursion depth exceeded the threshold @2 by @3'
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 recreate table log(id int primary key, att bigint default current_connection, event_name varchar(6) )
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create or alter trigger trg_attach on connect as
2024-06-11 09:15:19.554 declare v_pool_size int;
2024-06-11 09:15:19.554 begin
2024-06-11 09:15:19.554 if ( gen_id(g_attach,0) <= {STOP_RECURSIVE_ES_AFTER_ITER} ) then
2024-06-11 09:15:19.554 in autonomous transaction do
2024-06-11 09:15:19.554 insert into log(id, event_name) values (-gen_id(g_attach,1), 'attach');
2024-06-11 09:15:19.554 else
2024-06-11 09:15:19.554 exception exc_too_deep_recursion using ('trg_attach', {STOP_RECURSIVE_ES_AFTER_ITER}, gen_id(g_attach,1) - {STOP_RECURSIVE_ES_AFTER_ITER} - 1)
2024-06-11 09:15:19.554 ;
2024-06-11 09:15:19.554 end
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 create or alter trigger trg_detach on disconnect as
2024-06-11 09:15:19.554 begin
2024-06-11 09:15:19.554 if ( gen_id(g_detach,0) <= {STOP_RECURSIVE_ES_AFTER_ITER} ) then
2024-06-11 09:15:19.554 execute statement ('insert into log(id, event_name) values(?, ?)') (gen_id(g_detach,1), 'detach')
2024-06-11 09:15:19.554 with autonomous transaction
2024-06-11 09:15:19.554 on external 'localhost:' || rdb$get_context('SYSTEM', 'DB_NAME')
2024-06-11 09:15:19.554 as user '{act.db.user}' password '{act.db.password}' role 'R' || replace(uuid_to_char(gen_uuid()),'-','')
2024-06-11 09:15:19.554 ;
2024-06-11 09:15:19.554 else
2024-06-11 09:15:19.554 exception exc_too_deep_recursion using ('trg_detach', {STOP_RECURSIVE_ES_AFTER_ITER}, gen_id(g_detach,1) - {STOP_RECURSIVE_ES_AFTER_ITER} - 1)
2024-06-11 09:15:19.554 ;
2024-06-11 09:15:19.554 end
2024-06-11 09:15:19.554 ^
2024-06-11 09:15:19.554 set term ;^
2024-06-11 09:15:19.554 commit;
2024-06-11 09:15:19.554 select
2024-06-11 09:15:19.554 rdb$trigger_name as "rdb_trg_name"
2024-06-11 09:15:19.554 ,rdb$trigger_type as "rdb_trg_type"
2024-06-11 09:15:19.554 from rdb$triggers
2024-06-11 09:15:19.554 where rdb$system_flag is distinct from 1
2024-06-11 09:15:19.554 order by rdb$trigger_name;
2024-06-11 09:15:19.554 rollback;
2024-06-11 09:15:19.554 connect '{act.db.dsn}' user {act.db.user} password '{act.db.password}';
2024-06-11 09:15:19.554 quit;
2024-06-11 09:15:19.554 """
2024-06-11 09:15:19.554 with open(tmp_sql, 'w') as f:
2024-06-11 09:15:19.554 f.write(test_sql)
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 # Get Firebird log before test
2024-06-11 09:15:19.554 # ----------------------------
2024-06-11 09:15:19.554 fb_log_init = act.get_firebird_log()
2024-06-11 09:15:19.554 failed_finish_isql_msg = ''
2024-06-11 09:15:19.554 with act.db.connect() as con:
2024-06-11 09:15:19.554 with open(tmp_log, 'w') as f:
2024-06-11 09:15:19.554 try:
2024-06-11 09:15:19.554 p_handed_isql = subprocess.Popen( [act.vars['isql'], '-i', str(tmp_sql),
2024-06-11 09:15:19.554 '-user', act.db.user,
2024-06-11 09:15:19.554 '-password', act.db.password, act.db.dsn],
2024-06-11 09:15:19.554 stdout = f,
2024-06-11 09:15:19.554 stderr = subprocess.STDOUT
2024-06-11 09:15:19.554 )
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 for i in range(MAX_WAIT_FOR_ISQL_TERMINATE):
2024-06-11 09:15:19.554 time.sleep(1)
2024-06-11 09:15:19.554 # Check if child process has terminated.
2024-06-11 09:15:19.554 # Set and return returncode attribute. Otherwise, returns None.
2024-06-11 09:15:19.554 if p_handed_isql.poll() is not None:
2024-06-11 09:15:19.554 break
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 finally:
2024-06-11 09:15:19.554 p_handed_isql.terminate()
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 if p_handed_isql.poll() is None:
2024-06-11 09:15:19.554 failed_finish_isql_msg = f'isql_outcome: process WAS NOT terminated in {MAX_WAIT_FOR_ISQL_TERMINATE} second. Probably MAX_WAIT_FOR_ISQL_TERMINATE value must be increased.'
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 # Get Firebird log after test
2024-06-11 09:15:19.554 # ----------------------------
2024-06-11 09:15:19.554 fb_log_curr = act.get_firebird_log()
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 with open(tmp_log, 'a') as f:
2024-06-11 09:15:19.554 if failed_finish_isql_msg:
2024-06-11 09:15:19.554 f.write(failed_finish_isql_msg+'\n')
2024-06-11 09:15:19.554 for line in unified_diff(fb_log_init, fb_log_curr):
2024-06-11 09:15:19.554 if line.startswith('+'):
2024-06-11 09:15:19.554 f.write(line[1:] + '\n')
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 expected_stdout = f"""
2024-06-11 09:15:19.554 rdb_trg_name TRG_ATTACH
2024-06-11 09:15:19.554 rdb_trg_type 8192
2024-06-11 09:15:19.554 rdb_trg_name TRG_DETACH
2024-06-11 09:15:19.554 rdb_trg_type 8193
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 Error at disconnect:
2024-06-11 09:15:19.554 Execute statement error at attach :
2024-06-11 09:15:19.554 335544830 : Too many recursion levels of EXECUTE STATEMENT
2024-06-11 09:15:19.554 Data source : Firebird::
2024-06-11 09:15:19.554 At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 Error at disconnect:
2024-06-11 09:15:19.554 Execute statement error at attach :
2024-06-11 09:15:19.554 335544830 : Too many recursion levels of EXECUTE STATEMENT
2024-06-11 09:15:19.554 Data source : Firebird::
2024-06-11 09:15:19.554 At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 """
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 with open(tmp_log, 'r') as f:
2024-06-11 09:15:19.554 for line in f:
2024-06-11 09:15:19.554 print(line)
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 act.expected_stdout = expected_stdout
2024-06-11 09:15:19.554 act.stdout = capsys.readouterr().out
2024-06-11 09:15:19.554 > assert act.clean_stdout == act.clean_expected_stdout
2024-06-11 09:15:19.554 E AssertionError: assert
2024-06-11 09:15:19.554 E rdb_trg_name TRG_ATTACH
2024-06-11 09:15:19.554 E rdb_trg_type 8192
2024-06-11 09:15:19.554 E rdb_trg_name TRG_DETACH
2024-06-11 09:15:19.554 E rdb_trg_type 8193
2024-06-11 09:15:19.554 E Error at disconnect:
2024-06-11 09:15:19.554 E Execute statement error
2024-06-11 09:15:19.554 E 335544830 : Too many recursion levels of EXECUTE STATEMENT
2024-06-11 09:15:19.554 E Data source : Firebird::
2024-06-11 09:15:19.554 E At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E Error at disconnect:
2024-06-11 09:15:19.554 E Execute statement error
2024-06-11 09:15:19.554 E - 335544830 : Too many recursion levels of EXECUTE STATEMENT
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 3
2024-06-11 09:15:19.554 E Data source : Firebird::
2024-06-11 09:15:19.554 E At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 4
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 6
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 8
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 9
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 10
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 11
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554 E + Error at disconnect:
2024-06-11 09:15:19.554 E + Execute statement error
2024-06-11 09:15:19.554 E + 335544517 : exception 1
2024-06-11 09:15:19.554 E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 12
2024-06-11 09:15:19.554 E + Data source : Firebird::
2024-06-11 09:15:19.554 E + At trigger 'TRG_DETACH'
2024-06-11 09:15:19.554
2024-06-11 09:15:19.554 tests\bugs\gh_8077_test.py:199: AssertionError
2024-06-11 09:15:19.554 ---------------------------- Captured stdout setup ----------------------------
2024-06-11 09:15:19.554 Cached db: db-13.0-None-None-NONE.fdb [page_size=None, sql_dialect=None, charset='NONE'
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
tmp_sql = WindowsPath('R:/temp/qa/fbqa/test_11559/tmp_8077.sql')
tmp_log = WindowsPath('R:/temp/qa/fbqa/test_11559/tmp_8077.log')
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.es_eds
@pytest.mark.version('>=4.0.5')
def test_1(act: Action, tmp_sql: Path, tmp_log: Path, capsys):
test_sql = f"""
set list on;
set bail on;
set term ^;
create or alter trigger trg_detach on disconnect as begin end
^
create or alter trigger trg_attach on connect as begin end
^
create sequence g_attach
^
create sequence g_detach
^
create sequence g_diff
^
create exception exc_too_deep_recursion 'Execution terminated by @1: recursion depth exceeded the threshold @2 by @3'
^
recreate table log(id int primary key, att bigint default current_connection, event_name varchar(6) )
^
create or alter trigger trg_attach on connect as
declare v_pool_size int;
begin
if ( gen_id(g_attach,0) <= {STOP_RECURSIVE_ES_AFTER_ITER} ) then
in autonomous transaction do
insert into log(id, event_name) values (-gen_id(g_attach,1), 'attach');
else
exception exc_too_deep_recursion using ('trg_attach', {STOP_RECURSIVE_ES_AFTER_ITER}, gen_id(g_attach,1) - {STOP_RECURSIVE_ES_AFTER_ITER} - 1)
;
end
^
create or alter trigger trg_detach on disconnect as
begin
if ( gen_id(g_detach,0) <= {STOP_RECURSIVE_ES_AFTER_ITER} ) then
execute statement ('insert into log(id, event_name) values(?, ?)') (gen_id(g_detach,1), 'detach')
with autonomous transaction
on external 'localhost:' || rdb$get_context('SYSTEM', 'DB_NAME')
as user '{act.db.user}' password '{act.db.password}' role 'R' || replace(uuid_to_char(gen_uuid()),'-','')
;
else
exception exc_too_deep_recursion using ('trg_detach', {STOP_RECURSIVE_ES_AFTER_ITER}, gen_id(g_detach,1) - {STOP_RECURSIVE_ES_AFTER_ITER} - 1)
;
end
^
set term ;^
commit;
select
rdb$trigger_name as "rdb_trg_name"
,rdb$trigger_type as "rdb_trg_type"
from rdb$triggers
where rdb$system_flag is distinct from 1
order by rdb$trigger_name;
rollback;
connect '{act.db.dsn}' user {act.db.user} password '{act.db.password}';
quit;
"""
with open(tmp_sql, 'w') as f:
f.write(test_sql)
# Get Firebird log before test
# ----------------------------
fb_log_init = act.get_firebird_log()
failed_finish_isql_msg = ''
with act.db.connect() as con:
with open(tmp_log, 'w') as f:
try:
p_handed_isql = subprocess.Popen( [act.vars['isql'], '-i', str(tmp_sql),
'-user', act.db.user,
'-password', act.db.password, act.db.dsn],
stdout = f,
stderr = subprocess.STDOUT
)
for i in range(MAX_WAIT_FOR_ISQL_TERMINATE):
time.sleep(1)
# Check if child process has terminated.
# Set and return returncode attribute. Otherwise, returns None.
if p_handed_isql.poll() is not None:
break
finally:
p_handed_isql.terminate()
if p_handed_isql.poll() is None:
failed_finish_isql_msg = f'isql_outcome: process WAS NOT terminated in {MAX_WAIT_FOR_ISQL_TERMINATE} second. Probably MAX_WAIT_FOR_ISQL_TERMINATE value must be increased.'
# Get Firebird log after test
# ----------------------------
fb_log_curr = act.get_firebird_log()
with open(tmp_log, 'a') as f:
if failed_finish_isql_msg:
f.write(failed_finish_isql_msg+'\n')
for line in unified_diff(fb_log_init, fb_log_curr):
if line.startswith('+'):
f.write(line[1:] + '\n')
expected_stdout = f"""
rdb_trg_name TRG_ATTACH
rdb_trg_type 8192
rdb_trg_name TRG_DETACH
rdb_trg_type 8193
Error at disconnect:
Execute statement error at attach :
335544830 : Too many recursion levels of EXECUTE STATEMENT
Data source : Firebird::
At trigger 'TRG_DETACH'
Error at disconnect:
Execute statement error at attach :
335544830 : Too many recursion levels of EXECUTE STATEMENT
Data source : Firebird::
At trigger 'TRG_DETACH'
"""
with open(tmp_log, 'r') as f:
for line in f:
print(line)
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
> assert act.clean_stdout == act.clean_expected_stdout
E AssertionError: assert
E rdb_trg_name TRG_ATTACH
E rdb_trg_type 8192
E rdb_trg_name TRG_DETACH
E rdb_trg_type 8193
E Error at disconnect:
E Execute statement error
E 335544830 : Too many recursion levels of EXECUTE STATEMENT
E Data source : Firebird::
E At trigger 'TRG_DETACH'
E Error at disconnect:
E Execute statement error
E - 335544830 : Too many recursion levels of EXECUTE STATEMENT
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 3
E Data source : Firebird::
E At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 4
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 6
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 8
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 9
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 10
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 11
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
E + Error at disconnect:
E + Execute statement error
E + 335544517 : exception 1
E + 335545016 : Execution terminated by trg_attach: recursion depth exceeded the threshold 101 by 12
E + Data source : Firebird::
E + At trigger 'TRG_DETACH'
tests\bugs\gh_8077_test.py:199: AssertionError
|