Subject core dumps when stopping firebird-1.5.2 in linux
Author Todd Fisher
Hi,

I'm getting this core dump when I stop firebird classic server build in linux

#0 0x006a17a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x00892d86 in __nanosleep_nocancel () from /lib/tls/libc.so.6
#2 0x00892b83 in sleep () from /lib/tls/libc.so.6
#3 0x0806e9b6 in ah_crap_handler (signum=6) at nsSigHandlers.cpp:135
#4 0x0806f6cf in nsProfileLock::FatalSignalHandler (signo=6) at
nsProfileLock.cpp:209
#5 <signal handler called>
#6 0x006a17a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#7 0x00830955 in raise () from /lib/tls/libc.so.6
#8 0x00832319 in abort () from /lib/tls/libc.so.6
#9 0x00863f9a in __libc_message () from /lib/tls/libc.so.6
#10 0x0086a528 in _int_free () from /lib/tls/libc.so.6
#11 0x0086aafa in free () from /lib/tls/libc.so.6
#12 0x05eff445 in operator delete () from /usr/lib/libstdc++.so.6
#13 0x01d8408f in ALLD_fini () at alloc.h:341
#14 0x01ca5101 in cleanup (arg=0x0) at ../src/dsql/dsql.cpp:2533
#15 0x01c5c86d in gds__cleanup () at ../src/jrd/gds.cpp:3372
#16 0x008335d7 in exit () from /lib/tls/libc.so.6
#17 0x0081de3d in __libc_start_main () from /lib/tls/libc.so.6
#18 0x08057abd in _start ()


Looking into the source I think the problem is here:

while (clean = cleanup_handlers) {
cleanup_handlers = clean->clean_next;
routine = clean->clean_routine;
arg = clean->clean_arg;

/* We must free the handler before calling it because there
may be a handler (and is) that frees all memory that has
been allocated. */

FREE_LIB_MEMORY(clean);

#pragma FB_COMPILER_MESSAGE("Fix! Ugly function pointer cast!")

((void (*)(void *)) (*routine)) (arg); // in my case arg is 0x0 i.e. NULL
}

perhaps if a extra check for null was added here this would not be a problem?

-todd