DECLARED TEMP TABLE. Bugcheck "record disappeared (186), file: Savepoint.cpp line: 281" can occur if code can't be compiled

24 views
Skip to first unread message

Pavel Zotov

unread,
Jul 25, 2026, 7:00:45 AM (9 days ago) Jul 25
to firebird-devel
Usage of DTT can cause unexpected bugcheck when code can not be compiled because trivial error (eg missed 'USING....' in CRYPT_HASH() call, see below).

Consider script:
===========
set bail on;
set blob all;
set list on;
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb 2>nul;
create database 'localhost:r:\temp\tmp4test.fdb' user 'sysdba' password 'masterkey';

set autoterm on;
--set autoddl off; -- no matters
commit;

create or alter procedure sp_test returns(
    id016 smallint
) as
    declare temporary table tbase(
        id016 smallint
    );

begin
    -- insert into gtt_base(
    insert into tbase(
       id016
    ) values(
        -32768
    ) returning
       id016
    into
       id016
    ;
    suspend;
end;

--########################
-- MANDATORY to reproduce bug:
select p.* from sp_test p;
--########################
-- commit; -- [ 1 ] no error if this is UNcommented

execute block returns (execute_block_outcome varbinary(64)) as
    declare id016 smallint;
begin
    execute_block_outcome =
        crypt_hash (
            blob_append(
               id016
            )
            -- missed 'USING sha512' here
        )    
    ;
    suspend;
end;

===========

Its output will be:
=============
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 13, column 9
-)
=============
-- but firebird.log will contain after this:
=============
internal Firebird consistency check (record disappeared (186), file: Savepoint.cpp line: 281)
=============

No error will be if we use GTT instead of DTT.
No error if we UNcomment 'commit'  marked as '[ 1 ]'.

Dump, stack trace and FB snapshot + firebird.conf + .log are here.
(checked on 20260725_010828-6.0.0.2092-92bad46)



Adriano dos Santos Fernandes

unread,
Jul 25, 2026, 10:55:37 AM (8 days ago) Jul 25
to firebir...@googlegroups.com
On 7/25/26 08:00, Pavel Zotov wrote:
> -- but firebird.log will contain after this:
> =============
> internal Firebird consistency check (record disappeared (186), file:
> Savepoint.cpp line: 281)
> =============

I cannot reproduce.


Adriano

Pavel Zotov

unread,
Jul 25, 2026, 12:53:29 PM (8 days ago) Jul 25
to firebird-devel

firebird.conf:
============
BugCheckAbort = 1
RemoteServicePort = 3600
============

test.sql (seems that this is minimal script to reproduce; note: 'SET BAIL ON' must be here):
============
set bail on;

set list on;
shell if exist r:\temp\tmp4test.fdb del r:\temp\tmp4test.fdb 2>nul;
create database 'localhost:r:\temp\tmp4test.fdb' user sysdba password 'masterkey';

set autoterm on;
commit;

create or alter procedure sp_test returns(id016 smallint) as
    declare temporary table tbase(id016 smallint);
begin
    insert into tbase(id016) values(-32768) returning id016 into id016;
    suspend;
end;

select p.* from sp_test p;

execute block returns (execute_block_outcome varbinary(64)) as
begin
    execute_block_outcome = crypt_hash (blob_append(null) );
    suspend;
end;

============

Run:
%FB6X_HOME%\isql -q -i test.sql

Output:
============
ID016                           -32768


Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 13, column 9
-)
============

firebird.log after this:
============
PZ Sat Jul 25 19:38:32 2026
Database: R:\TEMP\TMP4TEST.FDB

internal Firebird consistency check (record disappeared (186), file: Savepoint.cpp line: 281)

PZ Sat Jul 25 19:38:34 2026
INET/inet_error: read errno = 10054, server host = localhost, address = ::1/3600

PZ Sat Jul 25 19:38:34 2026
REMOTE INTERFACE/gds__detach: Unsuccessful detach from database.
Uncommitted work may have been lost.
Error writing data to the connection.

============

Snapshot:  6.0.0.2092-0-92bad46-windows-x64-withDebugSymbols

Stack trace see in attached .7z
 
firebird_PID_13480.20260725_195101.WI-T6_0_0_2092.stack_trace.7z

Adriano dos Santos Fernandes

unread,
Jul 25, 2026, 3:42:38 PM (8 days ago) Jul 25
to firebir...@googlegroups.com
Fixed.


Adriano

Pavel Zotov

unread,
Jul 25, 2026, 7:09:17 PM (8 days ago) Jul 25
to firebird-devel

Fixed.

Confirmed. Tets has been committed.


 
Reply all
Reply to author
Forward
0 new messages