How to configure Firebird dump collection at Windows
How to configure Firebird dump collection at Windows
Shortly, there are two steps:
1. Set in firebird.conf parameter BugChechAbort=1 and restart Firebird to apply
2. Configure and verify dump collection for Firebird executable in Windows Error Reporting (WER)
Important!
Make sure you have files with debug information (extension *.pdb) in Firebird folder. HQbird has these files in the recent versions of distributions.
The following pdb files
* for Firebird 2.5.x:
fbclient.pdb, fbembed.pdb, fbserver.pdb и fb_inet_server.pdb – in bin\ folder of Firebird
* for Firebird 3.x:
fbclient.pdb and firebird.pdb – in root folder of Firebird;
engine12.pdb (for 3.x) and engine13.pdb (for 4.x)
- in folder plugins\
Setting up WER
To setup WER find in the registry the following key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
and open its subkeys.
Highlight "Windows Error Reporting" and make sure there is a parameter with the name Disabled, type REG_DWORD, and its value is 0.
Open it.
Note! Don’t confuse this folder with HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Error Reporting (without Windows after Microsoft\).
In the opened key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting
find subfolder LocalDumps; create it, if it does not exists.
Then open HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps.
WER allows specifying common and local (private) settings.
In general, we set up dumps for all processes.
For this, create parameters to subfolder LocalDumps:
- DumpFolder, REG_EXPAND_SZ, - folder name where to store dumps. Accounts which are used to run services to be dumped, must have permissions for this folder (that’s why network location can be a bad choice, since LocalSystem account, which is used by Firebird, does not have rights to access remote locations).
- DumpCount, REG_DWORD, - max number of dump files (dumps will be rotated after reaching its number).
- DumpType, REG_DWORD, - dump type, must be 2.
More details on WER setup
1) https://docs.microsoft.com/en-us/windows/desktop/wer/wer-settings
2) https://docs.microsoft.com/en-us/windows/desktop/wer/collecting-user-mode-dumps
Registry Key (create LocalDumps is necessary)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps
How to check dump creation (only when no actual users are connected!)
To test dump collection, we need to provoke Firebird crash: download https://ib-aid.com/download/killudf/badudf.dll.7z
unzip and put the badudf.dll to folder UDF and then run the following cmd file
@echo off setlocal enabledelayedexpansion enableextensions set fbc=C:\HQBird25\bin set dbnm=%~dp0tmptest.fdb.tmp set usr=SYSDBA set psw=masterkey del 2>nul echo create database 'localhost:!dbnm!' user '!usr!' password '!psw!'; | "!fbc!\isql.exe" -q -z ( echo set echo on; echo declare external function crashme echo returns int by value echo entry_point 'crashme' module_name 'badudf'; echo commit; echo show function; echo select crashme(^) from rdb$database; ) > %~dp0tmptest.sql.tmp "!fbc!\isql.exe" ^ localhost:!dbnm! ^ -q -i %~dp0tmptest.sql.tmp ^ -user !usr! -pas !psw! del !dbnm! del %~dp0tmptest.sql.tmp