Issue Details (XML | Word | Printable)

Key: CORE-6045
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Artyom Smirnov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Segmentation fault in fbtracemgr when closing it using ctrl-C

Created: 09/Apr/19 07:02 PM   Updated: 12/Apr/19 08:20 AM
Component/s: None
Affects Version/s: 3.0.4, 4.0 Beta 1
Fix Version/s: 3.0.5, 4.0 Beta 2

Environment: Linux
Issue Links:
Depend
 

QA Status: No test


 Description  « Hide
When embedded access is used (specially to embedded services manager) fb_shutdown() should be invoked before exit is called (including return from main()). Unfortunately in out utilities at_exit() function is used for it which is not good cause using it fb_shutdown() is called _during_ exit which appears to be too late in some cases.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 09/Apr/19 07:05 PM
Server hang in 6027 is not directly related to segfault in fbtracemgr but in provided test case caused by it.

Alexander Peshkov added a comment - 10/Apr/19 11:59 AM
I've fixed utilities working with services manager. They are primary candidates for causing segfaults.

Artyom Smirnov added a comment - 12/Apr/19 08:10 AM
I still see segfaults if AuditTraceConfigFile defined in firebird.conf

Artyom Smirnov added a comment - 12/Apr/19 08:20 AM
Some backtraces from cores I've observed:

Core was generated by `./bin/fbtracemgr -se service_mgr -user SYSDBA -password ********* -start -c fbt'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f3d859c1700 (LWP 461))]
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f3d86e41535 in __GI_abort () at abort.c:79
#2 0x00007f3d83cac706 in Firebird::system_call_failed::system_call_failed (this=0x7f3d74000e50, syscall=0x7f3d83d05f01 "pthread_mutex_destroy", error_code=16)
    at /workspace/rdb/firebird_3_0/src/common/fb_exception.cpp:244
#3 0x00007f3d83cac751 in Firebird::system_call_failed::raise (syscall=0x7f3d83d05f01 "pthread_mutex_destroy", error_code=16)
    at /workspace/rdb/firebird_3_0/src/common/fb_exception.cpp:250
#4 0x00007f3d83cab1df in Firebird::Mutex::~Mutex (this=0x7f3d83d76518 <Firebird::MemPool::init()::mpBuffer+664>, __in_chrg=<optimized out>)
    at /workspace/rdb/firebird_3_0/src/include/../common/classes/locks.h:220
#5 0x00007f3d83cc1e31 in Firebird::MemPool::~MemPool (this=0x7f3d83d76280 <Firebird::MemPool::init()::mpBuffer>, __in_chrg=<optimized out>)
    at /workspace/rdb/firebird_3_0/src/common/classes/alloc.cpp:2089
#6 0x00007f3d83cc4fbc in Firebird::MemPool::cleanup () at /workspace/rdb/firebird_3_0/src/common/classes/alloc.cpp:1845
#7 0x00007f3d83cc179e in Firebird::MemoryPool::cleanup () at /workspace/rdb/firebird_3_0/src/common/classes/alloc.cpp:2031
#8 0x00007f3d83cc0c2b in (anonymous namespace)::allClean () at /workspace/rdb/firebird_3_0/src/common/classes/init.cpp:157
#9 0x00007f3d83cc0cef in (anonymous namespace)::Cleanup::~Cleanup (this=0x7f3d83d76010 <(anonymous namespace)::global>, __in_chrg=<optimized out>)
    at /workspace/rdb/firebird_3_0/src/common/classes/init.cpp:172
#10 0x00007f3d86e63a77 in __cxa_finalize (d=0x7f3d83d75480) at cxa_finalize.c:83
#11 0x00007f3d83c689b3 in __do_global_dtors_aux () from /workspace/rdb/firebird_3_0/gen/Debug/firebird/plugins/libfbtrace.so
#12 0x00007f3d859bf870 in ?? ()
#13 0x00007f3d87513995 in _dl_close_worker (map=<optimized out>, force=<optimized out>) at dl-close.c:288
Backtrace stopped: frame did not save the PC


Core was generated by `./bin/fbtracemgr -se service_mgr -user SYSDBA -password ********* -start -c fbt'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fb954312c46 in Firebird::Array<Jrd::TraceManager::FactoryInfo, Firebird::EmptyStorage<Jrd::TraceManager::FactoryInfo> >::begin (this=0x0)
    at /workspace/rdb/firebird_3_0/src/jrd/trace/../../jrd/trace/../../common/classes/array.h:201
201 T* begin() { return data; }
[Current thread is 1 (Thread 0x7fb956a59d40 (LWP 1491))]
(gdb) bt
#0 0x00007fb954312c46 in Firebird::Array<Jrd::TraceManager::FactoryInfo, Firebird::EmptyStorage<Jrd::TraceManager::FactoryInfo> >::begin (this=0x0)
    at /workspace/rdb/firebird_3_0/src/jrd/trace/../../jrd/trace/../../common/classes/array.h:201
#1 0x00007fb95430fb62 in Jrd::TraceManager::update_session (this=0x7fb953d9efa0, session=...) at /workspace/rdb/firebird_3_0/src/jrd/trace/TraceManager.cpp:317
#2 0x00007fb95430f522 in Jrd::TraceManager::update_sessions (this=0x7fb953d9efa0) at /workspace/rdb/firebird_3_0/src/jrd/trace/TraceManager.cpp:222
#3 0x00007fb953eeb185 in Jrd::TraceManager::needs (this=0x7fb953d9efa0, e=15) at /workspace/rdb/firebird_3_0/src/jrd/../jrd/trace/TraceManager.h:125
#4 0x00007fb95407d240 in Jrd::Service::query2 (this=0x7fb953da5d50, send_item_length=8, send_items=0x7fff409c55e0 "@\004", recv_item_length=2,
    recv_items=0x7fff409c55de "?\001@\004", buffer_length=16383, info=0x7fff409c5611 "") at /workspace/rdb/firebird_3_0/src/jrd/svc.cpp:1519
#5 0x00007fb953fd71f0 in Jrd::JService::query (this=0x7fb953da0560, user_status=0x7fff409c5140, sendLength=8, sendItems=0x7fff409c55e0 "@\004",
    receiveLength=2, receiveItems=0x7fff409c55de "?\001@\004", bufferLength=16383, buffer=0x7fff409c55f0 "?\034")
    at /workspace/rdb/firebird_3_0/src/jrd/jrd.cpp:3932
#6 0x00007fb953ffffa2 in Firebird::IServiceBaseImpl<Jrd::JService, Firebird::CheckStatusWrapper, Firebird::IReferenceCountedImpl<Jrd::JService, Firebird::CheckStatusWrapper, Firebird::Inherit<Firebird::IVersionedImpl<Jrd::JService, Firebird::CheckStatusWrapper, Firebird::Inherit<Firebird::IService> > > > >::cloopqueryDispatcher (self=0x7fb953da0568, status=0x7fff409c52f8, sendLength=8, sendItems=0x7fff409c55e0 "@\004", receiveLength=2, receiveItems=0x7fff409c55de "?\001@\004",
    bufferLength=16383, buffer=0x7fff409c55f0 "?\034") at /workspace/rdb/firebird_3_0/src/include/firebird/IdlFbInterfaces.h:9128
#7 0x00007fb9572626f4 in Firebird::IService::query<Firebird::CheckStatusWrapper> (this=0x7fb953da0568, status=0x7fff409c52f0, sendLength=8,
    sendItems=0x7fff409c55e0 "@\004", receiveLength=2, receiveItems=0x7fff409c55de "?\001@\004", bufferLength=16383, buffer=0x7fff409c55f0 "?\034")
    at /workspace/rdb/firebird_3_0/src/include/firebird/IdlFbInterfaces.h:1998
#8 0x00007fb95725092b in Why::YService::query (this=0x7fb9571d3e00, status=0x7fff409c52f0, sendLength=8, sendItems=0x7fff409c55e0 "@\004", receiveLength=2,
    receiveItems=0x7fff409c55de "?\001@\004", bufferLength=16383, buffer=0x7fff409c55f0 "?\034") at /workspace/rdb/firebird_3_0/src/yvalve/why.cpp:5605
#9 0x00007fb957246a4e in isc_service_query (userStatus=0x7fff409c5530, handle=0x7fff409c9f28, sendItemLength=8, sendItems=0x7fff409c55e0 "@\004",
    recvItemLength=2, recvItems=0x7fff409c55de "?\001@\004", bufferLength=16383, buffer=0x7fff409c55f0 "?\034")
    at /workspace/rdb/firebird_3_0/src/yvalve/why.cpp:3337
#10 0x000056429ff537c9 in Firebird::TraceSvcUtil::runService (this=0x7fff409c9f20, spbSize=159, spb=0x7fb956a476e0 "\026\003\233")
    at /workspace/rdb/firebird_3_0/src/utilities/fbtracemgr/traceMgrMain.cpp:229
#11 0x000056429ff53151 in Firebird::TraceSvcUtil::startSession (this=0x7fff409c9f20, session=...)
    at /workspace/rdb/firebird_3_0/src/utilities/fbtracemgr/traceMgrMain.cpp:168
#12 0x000056429ff55d90 in Firebird::fbtrace (uSvc=0x7fb956a474c0, traceSvc=0x7fff409c9f20) at /workspace/rdb/firebird_3_0/src/jrd/trace/TraceCmdLine.cpp:408
#13 0x000056429ff53b69 in main (argc=10, argv=0x7fff409ca0e8) at /workspace/rdb/firebird_3_0/src/utilities/fbtracemgr/traceMgrMain.cpp:325