Skip to content

Regression in FB 3.x and 4.x when PSQL code has recursive SP calls: crash instead of SQLSTATE = 54001 ("Too many concurrent executions...") [CORE6445] #6678

Open
@firebird-automations

Description

@firebird-automations

Submitted by: @pavel-zotov

Attachments:
firebird.20201114_233518.WI-V4_0_0_2265.stack_trace.7z
firebird.20201114_233443.WI-V4_0_0_2265.stack_trace.7z
firebird.20201114_233425.WI-V4_0_0_2265.stack_trace.7z
firebird.20201114_233343.WI-V4_0_0_2265.stack_trace.7z
firebird.20201115_001609.WI-V3_0_8_33390.stack_trace.7z

Run following code on 4.x

SET BAIL ON;
shell del c:\temp\tmp4test.fdb 2>nul;
create database 'localhost:c:\temp\tmp4test.fdb' user 'SYSDBA' password 'masterkey';
commit;

set term ^;
create or alter procedure sp_level_0 as
begin
end
^

create or alter procedure sp_level_2 as
begin
execute procedure sp_level_0;
end
^

create or alter procedure sp_level_1 as
begin
execute procedure sp_level_2;
end
^

alter procedure sp_level_0 as
begin
execute procedure sp_level_1;
end
^

set term ;^
commit;

connect 'localhost:c:\temp\tmp4test.fdb' user 'SYSDBA' password 'masterkey';
set echo on;
execute procedure sp_level_1;
rollback;

On 4.0.0.2265 out will be:

execute procedure sp_level_1;
Statement failed, SQLSTATE = 08006
Error reading data from the connection.

Expected (and got on FB 2.5.9.27152 and 3.0.8.33390):

execute procedure sp_level_1;
Statement failed, SQLSTATE = 54001
Too many concurrent executions of the same request
-At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedure 'SP_LEVEL_0' line: 3, col: 5
At procedure 'SP_LEVEL_2' line: 3, col: 5
At procedure 'SP_LEVEL_1' line: 3, col: 5
At procedur...

Stack traces are in attached .7z files.

PS.

And one more issue.
Every odd (or even ?) run of this code leads to crash NOT instantly but after ~30 seconds. This occurs regardless whether i restart FB service before it or no.
This is log of console when output was provided with timestamps by mtee.exe utility:

run-1:

23:33:43.324 execute procedure sp_level_1;
23:33:43.937 Statement failed, SQLSTATE = 08006
23:33:43.938 Error reading data from the connection.

run-2:

23:33:58.673 execute procedure sp_level_1;
23:34:25.133 Statement failed, SQLSTATE = 08006
23:34:25.133 Error reading data from the connection.

run-3:

23:34:42.804 execute procedure sp_level_1;
23:34:43.629 Statement failed, SQLSTATE = 08006
23:34:43.629 Error reading data from the connection.

run-4:

23:34:52.307 execute procedure sp_level_1;
23:35:18.839 Statement failed, SQLSTATE = 08006
23:35:18.839 Error reading data from the connection.

PPS.

firebird.conf:

AuthClient = Srp, Srp256, ExtAuth, Win_Sspi, Legacy_Auth
AuthServer = Srp, Srp256, ExtAuth, Win_Sspi, Legacy_Auth
BugCheckAbort = 1
DefaultDbCachePages = 20000
ExtConnPoolLifeTime = 10
ExtConnPoolSize = 10
ExternalFileAccess = Full
FileSystemCacheThreshold = 65536K
IpcName = fb40_SS
KeyHolderPlugin = KeyHolder
LockHashSlots = 22111
LockMemSize = 5M
MaxUnflushedWrites = -1
MaxUnflushedWriteTime = -1
ReadConsistency = 0
RemoteServicePort = 3400
ServerMode = Super
TempBlockSize = 2M
TempCacheLimit = 2147483647
TempDirectories = d:\temp
UDFAccess = Restrict UDF
UserManager = Srp, Legacy_UserManager
WireCrypt = Enabled
WireCryptPlugin = ChaCha, Arc4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions