From 4d0ff477a76ef2863669c6efbbca5e93cf17c4ee Mon Sep 17 00:00:00 2001 From: zotov Date: Wed, 1 Feb 2023 22:17:29 +0300 Subject: [PATCH] Added/Updated D:\FB\firebird-qa\tests\bugs\gh_7446_check_regression_test.py: Checked on 3.0.11.33658; 4.0.3.2894 -- all fine. NOTE: Build 5.0.0.920: still has a problem with BUGCHECK --- tests/bugs/gh_7446_check_regression_test.py | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/bugs/gh_7446_check_regression_test.py diff --git a/tests/bugs/gh_7446_check_regression_test.py b/tests/bugs/gh_7446_check_regression_test.py new file mode 100644 index 00000000..05acb613 --- /dev/null +++ b/tests/bugs/gh_7446_check_regression_test.py @@ -0,0 +1,69 @@ +#coding:utf-8 + +""" +ID: issue-7446 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/7446 +DESCRIPTION: + Problem was reported privately by firebird user. As a visible result there were core dump and an error in firebird.log: + Operating system call pthread_mutex_lock failed. Error code 22 + + An error happens due to an attempt to cleanup (too late attempt - when processing disconnect in CS) + savepoint stored in metadata cache. Put attention that savepoints are always created in transaction memory pool and keeping + them after commit/rollback in metadata cache is bad idea. + +NOTES: + [01.02.2023] pzotov + This test checks regression that was introduced by first attempt to solve problem described in the title. + SQL example was provided by dimitr, see letter 31-jan-2023 13:43. Running SQL script must NOT issue any output. + There is NO_FBT analog for this test. + + Regression can be reproduced on: + * FB 3.0.11.33654 (17-jan-2023): "SQLSTATE = 3B000 / Unable to find savepoint with name S in transaction context". + * FB 5.0.0.907 (12-jan-2023): "consistency check (decompression overran buffer (179), file: sqz.cpp line: 487)" + Checked on: + 3.0.11.33658; 4.0.3.2894 -- all fine. + + ::: ACHTUNG ::: + Build 5.0.0.920 (01-feb-2022): still has a problem with BUGCHECK, see above for 5.0.0.907. +""" + +import pytest +import locale +from firebird.qa import * +from firebird.driver import TraAccessMode, TPB + +db = db_factory() +act = python_act('db') + +@pytest.mark.version('>=3.0.11') +def test_1(act: Action): + + sql_chk = """ + set term ^; + create procedure p0 returns (r int) + as + begin + r = 0; + suspend; + end^ + + create procedure p returns (r int) + as + begin + in autonomous transaction do + begin + select p0.r from p0 into :r; + end + + suspend; + end^ + set term ;^ + + savepoint s; + set heading off; + select * from p; + release savepoint s; + """ + act.expected_stdout = "0" + act.isql(switches = ['-q'], input = sql_chk, combine_output = True, io_enc = locale.getpreferredencoding()) + assert act.clean_stdout == act.clean_expected_stdout