Subject gbak segfaults on restore
Author Alexander Marx
hello list,


i've to restore some Firebird 1.5 database but constantly keep getting
segfaults from gbak; always at (or after?) restoring the indices ..

sidenote: the database in question uses a proprietary UDF library
written in Delphi; but since it was previously always possible to
restore that database and nothing systemrelated has changed ..
(eg. same udf lib, same fb, same kernel, same os ..)

i'm a bit at a loss as to were to start debugging the problem ..

might a firebird upgrade help? 1.5.3?
any help/pointers/ideas greatly appreciated ...


thx,
alex.



====== sys descr, debug output etc. follows ======


system is a dual opteron box, running debian linux (sarge),
with kernel 2.6.12.2 SMP + PAE (since the box runs with 8GB ram)
and firebird-classic 1.5.1-4



gbak output as follows:

...
[tables, privs, triggers, etc snipped]
...
gbak: restoring index RDB$FOREIGN134
gbak: restoring index RDB$FOREIGN131
gbak: restoring index RDB$FOREIGN132
gbak: restoring index RDB$FOREIGN130
gbak: restoring index RDB$FOREIGN129
gbak: restoring index RDB$FOREIGN128
gbak: restoring index RDB$FOREIGN127
gbak: restoring index RDB$FOREIGN121
gbak: restoring index RDB$FOREIGN122
gbak: restoring index RDB$FOREIGN123
gbak: restoring index RDB$FOREIGN124
gbak: restoring index RDB$FOREIGN125
gbak: restoring index RDB$FOREIGN126
gbak: restoring index RDB$FOREIGN120
gbak: restoring index RDB$FOREIGN118
<Segmentation Fault>


and here is the strace output from the crashing gbak process:
...
brk(0) = 0x94d2000
brk(0x94ce000) = 0x94ce000
brk(0) = 0x94ce000
brk(0) = 0x94ce000
brk(0) = 0x94ce000
brk(0x94ca000) = 0x94ca000
brk(0) = 0x94ca000
brk(0) = 0x94ca000
brk(0) = 0x94ca000
brk(0x94c6000) = 0x94c6000
brk(0) = 0x94c6000
brk(0) = 0x94c6000
brk(0) = 0x94c6000
brk(0x94c2000) = 0x94c2000
brk(0) = 0x94c2000
brk(0) = 0x94c2000
brk(0) = 0x94c2000
brk(0x94be000) = 0x94be000
brk(0) = 0x94be000
brk(0) = 0x94be000
brk(0) = 0x94be000
brk(0x94ba000) = 0x94ba000
brk(0) = 0x94ba000
time(NULL) = 1146238396
time(NULL) = 1146238396
semop(0, 0xbffee3a0, 1) = 0
semop(0, 0xbffee400, 1) = 0
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
semop(0, 0xbffee3a0, 1) = 0
semop(0, 0xbffee400, 1) = 0
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
time(NULL) = 1146238396
access("/usr/lib/firebird2/UDF/xyz_udf", R_OK) = -1 ENOENT (No such file or
directory)
access("/usr/lib/firebird2/UDF/xyz_udf.so", R_OK) = -1 ENOENT (No such file
or directory)
access("/usr/lib/firebird2/UDF/libxyz_udf.so", R_OK) = 0
stat64("/usr/lib/firebird2/UDF/libxyz_udf.so", {st_mode=S_IFREG|0755,
st_size=197528, ...}) = 0
lstat64("/usr/lib/firebird2/UDF/libxyz_udf.so", {st_mode=S_IFREG|0755,
st_size=197528, ...}) = 0
open("/usr/lib/firebird2/UDF/libxyz_udf.so", O_RDONLY) = 9
read(9, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\0\0\000"...,
512) = 512
fstat64(9, {st_mode=S_IFREG|0755, st_size=197528, ...}) = 0
old_mmap(NULL, 1252780, PROT_READ|PROT_EXEC, MAP_PRIVATE, 9, 0) = 0xb278f000
mprotect(0xb27bc000, 1068460, PROT_NONE) = 0
mprotect(0xb27bb000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
mprotect(0xb27bb000, 4096, PROT_READ|PROT_EXEC) = 0
old_mmap(0xb27bc000, 1046132, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb27bc000
old_mmap(0xb28bc000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 9,
0x2c000) = 0xb28bc000
old_mmap(0xb28c0000, 3500, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb28c0000
close(9) = 0
dup(1) = 9
fcntl64(9, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat64(9, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7fd7000
_llseek(9, 0, 0xbffec0dc, SEEK_CUR) = -1 ESPIPE (Illegal seek)
futex(0xb28c09e4, FUTEX_WAKE, 2147483647) = 0
pipe([10, 11]) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


is the UDF library corrupt? hmm .. but its the same lib, as it
was installed last year ... !?

host:/root# ls -l /usr/lib/firebird2/UDF/libxyz_udf.so
-rwxr-xr-x 1 root root 197528 Nov 30 14:43
/usr/lib/firebird2/UDF/libxyz_udf.so