Subject Re: DROP table statement hangs Firebird Server process with 100% CPU usage
Author
After I killer the 2.5.8 server here is the backtrace:

(gdb) continue
Continuing.

Thread 1 "fbserver" received signal SIGTERM, Terminated.
0x00007f4090f4374d in poll () at ../sysdeps/unix/syscall-template.S:84

(gdb) bt

#0  0x00007f4090f4374d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00000000006d98e5 in Select::select (timeout=<optimized out>, 
    this=<optimized out>) at ../src/remote/inet.cpp:381
#2  select_wait (selct=<optimized out>, main_port=<optimized out>)
    at ../src/remote/inet.cpp:2461
#3  select_multi (main_port=0x7f4090c16bd0, buffer=0x7f408fabb000 "", bufsize=8192, 
    length=0x7fffc77b11ce, port=...) at ../src/remote/inet.cpp:2236
#4  0x00000000004152d0 in SRVR_multi_thread (main_port=0x7f4090c16bd0, 
    flags=<optimized out>) at ../src/remote/server.cpp:636
#5  0x000000000040d72c in server_main (argc=<optimized out>, argv=<optimized out>)
    at ../src/remote/inet_server.cpp:430
#6  0x00007f4090e68830 in __libc_start_main (main=0x4198c0 <main(int, char**)>, 
    argc=1, argv=0x7fffc77b2838, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffc77b2828) at ../csu/libc-start.c:291
#7  0x000000000040cef9 in _start ()

(gdb) thread apply all bt

Thread 8 (Thread 0x7f4087fff700 (LWP 20964)):
#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007f409121be42 in __GI___pthread_mutex_lock (mutex=0x7f408f8aa830)
    at ../nptl/pthread_mutex_lock.c:115
#2  0x000000000060c1b4 in Firebird::Mutex::enter (this=<optimized out>)
    at ../src/include/../common/classes/locks.h:170
#3  Jrd::Database::Sync::lock (ast=<optimized out>, this=<optimized out>)
    at ../src/jrd/../jrd/../jrd/Database.h:163
#4  Jrd::Database::Checkout::~Checkout (this=<optimized out>, 
    __in_chrg=<optimized out>) at ../src/jrd/../jrd/../jrd/Database.h:301
#5  garbage_collector (arg=<optimized out>) at ../src/jrd/vio.cpp:4361
#6  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#7  (anonymous namespace)::threadStart (arg=0x7f408f8aaf90)
    at ../src/jrd/ThreadStart.cpp:139
#8  0x00007f40912196ba in start_thread (arg=0x7f4087fff700) at pthread_create.c:333
#9  0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 7 (Thread 0x7f408dcf5700 (LWP 20963)):
#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007f409121be42 in __GI___pthread_mutex_lock (mutex=0x7f408f8aa830)
    at ../nptl/pthread_mutex_lock.c:115
#2  0x00000000004f1768 in Firebird::Mutex::enter (this=<optimized out>)
    at ../src/include/../common/classes/locks.h:170
#3  Jrd::Database::Sync::lock (ast=<optimized out>, this=<optimized out>)
    at ../src/jrd/../jrd/../jrd/Database.h:163
#4  Jrd::Database::Checkout::~Checkout (this=<optimized out>, 
    __in_chrg=<optimized out>) at ../src/jrd/../jrd/../jrd/Database.h:301
#5  cache_writer (arg=<optimized out>) at ../src/jrd/cch.cpp:4274
#6  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#7  (anonymous namespace)::threadStart (arg=0x7f408f8aaf90)
    at ../src/jrd/ThreadStart.cpp:139
#8  0x00007f40912196ba in start_thread (arg=0x7f408dcf5700) at pthread_create.c:333
#9  0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 6 (Thread 0x7f40877fe700 (LWP 20962)):
#0  0x00007f4091221a15 in futex_abstimed_wait_cancelable (private=0, 
    abstime=0x7f40877fdb40, expected=0, futex_word=0x7f408ed62268)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x7f408ed62268, 
    abstime=abstime@entry=0x7f40877fdb40) at sem_waitcommon.c:111
#2  0x00007f4091221adf in __new_sem_wait_slow (sem=0x7f408ed62268, 
---Type <return> to continue, or q <return> to quit---
    abstime=0x7f40877fdb40) at sem_waitcommon.c:181
#3  0x00007f4091221b92 in sem_timedwait (sem=<optimized out>, 
    abstime=<optimized out>) at sem_timedwait.c:36
#4  0x000000000073bb20 in Firebird::SignalSafeSemaphore::tryEnter (
    this=0x7f408ed62268, seconds=<optimized out>, milliseconds=<optimized out>)
    at ../src/common/classes/semaphore.cpp:171
#5  0x000000000060c199 in garbage_collector (arg=<optimized out>)
    at ../src/jrd/vio.cpp:4361
#6  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#7  (anonymous namespace)::threadStart (arg=0x7f408fab4ae0)
    at ../src/jrd/ThreadStart.cpp:139
#8  0x00007f40912196ba in start_thread (arg=0x7f40877fe700) at pthread_create.c:333
#9  0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 5 (Thread 0x7f408cce3700 (LWP 20961)):
#0  0x00007f4091221a15 in futex_abstimed_wait_cancelable (private=0, 
    abstime=0x7f408cce2bf0, expected=0, futex_word=0x7f408ed62208)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x7f408ed62208, 
    abstime=abstime@entry=0x7f408cce2bf0) at sem_waitcommon.c:111
#2  0x00007f4091221adf in __new_sem_wait_slow (sem=0x7f408ed62208, 
    abstime=0x7f408cce2bf0) at sem_waitcommon.c:181
#3  0x00007f4091221b92 in sem_timedwait (sem=<optimized out>, 
    abstime=<optimized out>) at sem_timedwait.c:36
#4  0x000000000073bb20 in Firebird::SignalSafeSemaphore::tryEnter (
    this=0x7f408ed62208, seconds=<optimized out>, milliseconds=<optimized out>)
    at ../src/common/classes/semaphore.cpp:171
#5  0x00000000004f174b in cache_writer (arg=<optimized out>)
    at ../src/jrd/cch.cpp:4274
#6  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#7  (anonymous namespace)::threadStart (arg=0x7f408fab4ae0)
    at ../src/jrd/ThreadStart.cpp:139
#8  0x00007f40912196ba in start_thread (arg=0x7f408cce3700) at pthread_create.c:333
#9  0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 4 (Thread 0x7f408e556700 (LWP 20952)):
#0  release_bdb (tdbb=0x7f408e5550f0, bdb=0x7f408ec1a4a0, repost=<optimized out>, 
    downgrade_latch=false, rel_mark_latch=true) at ../src/jrd/cch.cpp:6060
#1  0x00000000004efc35 in CCH_release (tdbb=0x7f408e5550f0, window=0x7f408e554830, 
    release_tail=false) at ../src/jrd/cch.cpp:2161
#2  0x00000000005a6d71 in CCH_RELEASE (window=<optimized out>, tdbb=<optimized out>)
    at ../src/jrd/../jrd/cch_proto.h:101
#3  PAG_release_page (tdbb=0x7f408e5550f0, number=..., prior_page=...)
    at ../src/jrd/pag.cpp:1819
#4  0x000000000044bbac in delete_tail (length=<optimized out>, 
    page_space=<optimized out>, header=<optimized out>, tdbb=<optimized out>)
    at ../temp/superserver/jrd/dpm.cpp:2514
#5  DPM_delete_relation_pages (tdbb=0x7f408e5550f0, relation=0x7f408ebca7d8, 
    relPages=0x7f408ebca988) at ../temp/superserver/jrd/dpm.cpp:1043
#6  0x000000000044be4b in DPM_delete_relation (tdbb=0x7f408e5550f0, 
    relation=0x7f408ebca7d8) at ../temp/superserver/jrd/dpm.cpp:969
#7  0x0000000000518491 in delete_relation (tdbb=0x7f408e5550f0, 
    phase=<optimized out>, work=0x7f408ea82100, transaction=0x7f408eb6b7c0)
    at ../temp/superserver/jrd/dfw.cpp:5179
#8  0x000000000050c5e9 in DFW_perform_work (tdbb=0x7f408e5550f0, 
    transaction=0x7f408eb6b7c0) at ../temp/superserver/jrd/dfw.cpp:1197
#9  0x00000000005f3d6b in TRA_commit (tdbb=0x7f408e5550f0, 
    transaction=0x7f408eb6b7c0, retaining_flag=false) at ../src/jrd/tra.cpp:496
#10 0x0000000000569b3d in commit (tdbb=0x7f408e5550f0, transaction=<optimized out>, 
    retaining_flag=false) at ../src/jrd/jrd.cpp:4615
#11 0x0000000000569bd6 in JRD_commit_transaction (tdbb=0x7f408e5550f0, 
    transaction=0x7f408f8ab170) at ../src/jrd/jrd.cpp:7057
#12 0x0000000000571c21 in jrd8_commit_transaction (user_status=0x7f408e5559a0, 
    tra_handle=0x7f408f8ab170) at ../src/jrd/jrd.cpp:1811
#13 0x0000000000436cdb in isc_commit_transaction (user_status=<optimized out>, 
    tra_handle=0x7f4090c0f4a8) at ../src/jrd/why.cpp:1749
#14 0x0000000000410487 in rem_port::end_transaction (this=0x7f408fab1800, 
    operation=op_commit, release=<optimized out>, sendL=0x7f408faaff88)
    at ../src/remote/server.cpp:2086
#15 0x00000000004173e4 in process_packet (port=0x7f408fab1800, sendL=0x7f408faaff88, 
    receive=0x7f408fab0398, result=0x7f408e555ea8) at ../src/remote/server.cpp:3441
#16 0x00000000004183a7 in loopThread () at ../src/remote/server.cpp:5268
#17 0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#18 (anonymous namespace)::threadStart (arg=0x7f4090c0f770)
    at ../src/jrd/ThreadStart.cpp:139
#19 0x00007f40912196ba in start_thread (arg=0x7f408e556700) at pthread_create.c:333
#20 0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f408f8a9700 (LWP 20402)):
#0  0x00007f4091221a15 in futex_abstimed_wait_cancelable (private=0, 
    abstime=0x7f408f8a8e60, expected=0, futex_word=0x7f408f8ab038)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x7f408f8ab038, 
    abstime=abstime@entry=0x7f408f8a8e60) at sem_waitcommon.c:111
#2  0x00007f4091221adf in __new_sem_wait_slow (sem=0x7f408f8ab038, 
---Type <return> to continue, or q <return> to quit---
    abstime=0x7f408f8a8e60) at sem_waitcommon.c:181
#3  0x00007f4091221b92 in sem_timedwait (sem=<optimized out>, 
    abstime=<optimized out>) at sem_timedwait.c:36
#4  0x000000000073bb20 in Firebird::SignalSafeSemaphore::tryEnter (
    this=0x7f408f8ab038, seconds=<optimized out>, milliseconds=<optimized out>)
    at ../src/common/classes/semaphore.cpp:171
#5  0x0000000000635dd1 in Jrd::ConfigStorage::touchThreadFunc (this=0x7f4090c11250)
    at ../src/jrd/trace/TraceConfigStorage.cpp:352
#6  0x0000000000635ed9 in Jrd::ConfigStorage::touchThread (arg=0x7f408f8ab038)
    at ../src/jrd/trace/TraceConfigStorage.cpp:338
#7  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#8  (anonymous namespace)::threadStart (arg=0x7f408f8ba110)
    at ../src/jrd/ThreadStart.cpp:139
#9  0x00007f40912196ba in start_thread (arg=0x7f408f8a9700) at pthread_create.c:333
#10 0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f40903ce700 (LWP 20401)):
#0  0x00007f4091221827 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, 
    expected=0, futex_word=0x7f4090c1b9f8)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x7f4090c1b9f8, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007f40912218d4 in __new_sem_wait_slow (sem=0x7f4090c1b9f8, abstime=0x0)
    at sem_waitcommon.c:181
#3  0x00007f409122197a in __new_sem_wait (sem=<optimized out>) at sem_wait.c:29
#4  0x000000000073b9f8 in Firebird::SignalSafeSemaphore::enter (this=<optimized out>)
    at ../src/common/classes/semaphore.cpp:132
#5  0x000000000043cb59 in (anonymous namespace)::shutdownThread ()
    at ../src/jrd/why.cpp:933
#6  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#7  (anonymous namespace)::threadStart (arg=0x7f4090c129c0)
    at ../src/jrd/ThreadStart.cpp:139
#8  0x00007f40912196ba in start_thread (arg=0x7f40903ce700) at pthread_create.c:333
#9  0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f4092731740 (LWP 20396)):
#0  0x00007f4090f4374d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00000000006d98e5 in Select::select (timeout=<optimized out>, 
    this=<optimized out>) at ../src/remote/inet.cpp:381
#2  select_wait (selct=<optimized out>, main_port=<optimized out>)
    at ../src/remote/inet.cpp:2461
#3  select_multi (main_port=0x7f4090c16bd0, buffer=0x7f408fabb000 "", bufsize=8192, 
    length=0x7fffc77b11ce, port=...) at ../src/remote/inet.cpp:2236
---Type <return> to continue, or q <return> to quit---
#4  0x00000000004152d0 in SRVR_multi_thread (main_port=0x7f4090c16bd0, 
    flags=<optimized out>) at ../src/remote/server.cpp:636
#5  0x000000000040d72c in server_main (argc=<optimized out>, argv=<optimized out>)
    at ../src/remote/inet_server.cpp:430
#6  0x00007f4090e68830 in __libc_start_main (main=0x4198c0 <main(int, char**)>, 
    argc=1, argv=0x7fffc77b2838, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffc77b2828) at ../csu/libc-start.c:291
#7  0x000000000040cef9 in _start ()




 
#0  0x00007f4091221827 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, 
    expected=0, futex_word=0x7f4090c1b9f8)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x7f4090c1b9f8, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007f40912218d4 in __new_sem_wait_slow (sem=0x7f4090c1b9f8, abstime=0x0)
    at sem_waitcommon.c:181
#3  0x00007f409122197a in __new_sem_wait (sem=<optimized out>) at sem_wait.c:29
#4  0x000000000073b9f8 in Firebird::SignalSafeSemaphore::enter (this=<optimized out>)
    at ../src/common/classes/semaphore.cpp:132
#5  0x000000000043cb59 in (anonymous namespace)::shutdownThread ()
    at ../src/jrd/why.cpp:933
#6  0x000000000042ae92 in (anonymous namespace)::ThreadArgs::run (
    this=<optimized out>) at ../src/jrd/ThreadStart.cpp:128
#7  (anonymous namespace)::threadStart (arg=0x7f4090c129c0)
    at ../src/jrd/ThreadStart.cpp:139
#8  0x00007f40912196ba in start_thread (arg=0x7f40903ce700) at pthread_create.c:333
#9  0x00007f4090f4f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f4092731740 (LWP 20396)):
#0  0x00007f4090f4374d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00000000006d98e5 in Select::select (timeout=<optimized out>, 
    this=<optimized out>) at ../src/remote/inet.cpp:381
#2  select_wait (selct=<optimized out>, main_port=<optimized out>)
    at ../src/remote/inet.cpp:2461
#3  select_multi (main_port=0x7f4090c16bd0, buffer=0x7f408fabb000 "", bufsize=8192, 
    length=0x7fffc77b11ce, port=...) at ../src/remote/inet.cpp:2236
---Type <return> to continue, or q <return> to quit---
#4  0x00000000004152d0 in SRVR_multi_thread (main_port=0x7f4090c16bd0, 
    flags=<optimized out>) at ../src/remote/server.cpp:636
#5  0x000000000040d72c in server_main (argc=<optimized out>, argv=<optimized out>)
    at ../src/remote/inet_server.cpp:430
#6  0x00007f4090e68830 in __libc_start_main (main=0x4198c0 <main(int, char**)>, 
    argc=1, argv=0x7fffc77b2838, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffc77b2828) at ../csu/libc-start.c:291
#7  0x000000000040cef9 in _start ()