Packaged temporary tables usage causes either FB crash or hang

23 views
Skip to first unread message

Pavel Zotov

unread,
May 30, 2026, 3:51:44 AM (4 days ago) May 30
to firebird-devel
Consider script from attachment .zip and batch ( it must be saved with same name as attached .zip, i.e. pg-temptab.bat ):
=============
@echo off
setlocal enabledelayedexpansion enableextensions

@rem #################
set fb_home=C:\FB\60SS
@rem #################

set joblog=%~dpn0.log
set tmplog=%~dpn0.tmp
if exist !joblog! del !joblog!
set /a iter=0
:m1
    set /a iter=!iter!+1
    echo .................... iter !iter! ..................
    !fb_home!\isql.exe -q -e -z -i %~dpn0.sql 1>!tmplog! 2>&1
    set elev=!errorlevel!
    type !tmplog! >> !joblog!
    del !tmplog!

    if NOT !elev! EQU 0 (
        goto :fin
    )
goto :m1

:fin
    echo Bye-bye from %~f0

=============
(one need to adjust "fb_home" variable to your env.)

Run this batch. Its output will be:
.................... iter 1 ..................
.................... iter 2 ..................
.................... iter 3 ..................
...

After some count of iterations (on my PC it is about 30...50) either FB will hang or crashed.

FB snapshot ( 6.0.0.1976-eead264-x64 ), dumps and stack traces are here

pg-temptab.sql.zip

Pavel Zotov

unread,
May 30, 2026, 4:11:52 AM (4 days ago) May 30
to firebird-devel
PS. Trace shows error related to DB file corruption:

2026-05-30T11:07:58.9880 (5168:0000000006E704C0) PREPARE_STATEMENT
R:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, UTF8, TCPv6:::1/58663)
C:\FB\60SS\isql.exe:5736

-------------------------------------------------------------------------------
SET TRANSACTION
      0 ms

2026-05-30T11:07:58.9880 (5168:0000000006E704C0) FAILED EXECUTE_STATEMENT_FINISH
R:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, UTF8, TCPv6:::1/58663)
C:\FB\60SS\isql.exe:5736

-------------------------------------------------------------------------------
SET TRANSACTION
0 records fetched
      0 ms, 1 write(s), 6 fetch(es), 3 mark(s)

2026-05-30T11:07:58.9880 (5168:0000000006E704C0) ERROR AT JAttachment::execute
R:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, UTF8, TCPv6:::1/58663)
C:\FB\60SS\isql.exe:5736
335544335 : database file appears corrupt (bad pointer page (259))


суббота, 30 мая 2026 г. в 10:51:44 UTC+3, Pavel Zotov:

Adriano dos Santos Fernandes

unread,
May 30, 2026, 6:40:45 PM (4 days ago) May 30
to firebir...@googlegroups.com
On 5/30/26 04:51, Pavel Zotov wrote:
> Consider script from attachment .zip and batch ( it must be saved with
> same name as attached .zip, i.e. *pg-temptab.bat* ):
> =============
> @echo off
> setlocal enabledelayedexpansion enableextensions
>
> @rem #################
> set fb_home=C:\FB\60SS
> @rem #################
>
> set joblog=%~dpn0.log
> set tmplog=%~dpn0.tmp
> if exist !joblog! del !joblog!
> set /a iter=0
> :m1
>     set /a iter=!iter!+1
>     echo .................... iter !iter! ..................
>     !fb_home!\isql.exe -q -e -z -i %~dpn0.sql 1>!tmplog! 2>&1
>     set elev=!errorlevel!
>     type !tmplog! >> !joblog!
>     del !tmplog!
>
>     if NOT !elev! EQU 0 (
>         goto :fin
>     )
> goto :m1
>
> :fin
>     echo Bye-bye from %~f0
> =============
> (one need to adjust "*fb_home*" variable to your env.)
>
> Run this batch. Its output will be:
> .................... iter 1 ..................
> .................... iter 2 ..................
> .................... iter 3 ..................
> ...
>
> After some count of iterations (on my PC it is about 30...50) either FB
> will hang or crashed.
>
> FB snapshot ( 6.0.0.1976-eead264-x64 ), dumps and stack traces are here
> <https://drive.google.com/drive/folders/1C7eE5a-
> KJ3GiLCGaKRyTc2NG7Z1u2VpX?usp=sharing>
>

The only problem I can reproduce is this assert:

void Database::markForDelete(RelationPermanent* relation)
{
MutexLockGuard g(dbb_del_pages_mutex, FB_FUNCTION);

#ifdef DEV_BUILD
FB_SIZE_T dummy;
bool rc = dbb_del_pages.findEx(
[relation](const DelPagesMarker& item) -> int
{
return std::greater{}(item.relation, relation);
},
dummy);
fb_assert(!rc);
#endif

dbb_del_pages.add({dbb_next_transaction, relation});
}

Once removed it, no crash happens running the script in a loop.


Adriano

Pavel Zotov

unread,
May 31, 2026, 9:37:49 AM (3 days ago) May 31
to firebird-devel

> The only problem I can reproduce is this assert:
>   void Database::markForDelete(RelationPermanent* relation)
>   ...

>   Once removed it, no crash happens running the script in a loop.


Maybe problem with crash was resolved but  i still see that FB hangs, very soon after start batch loop.
Checked on Firebird-6.0.0.1976-0-33384b2-windows-x64.zip (got if from artefacts).
This is url to snapshot, dumps and stack traces for hanging firebird and isql, + lockprint.

Reply all
Reply to author
Forward
0 new messages