Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBSVCMGR with action_trace_start prevents in 3.0 SuperServer from connecting using local protocol [CORE4889] #5183

Closed
firebird-issue-importer opened this issue Jul 28, 2015 · 9 comments

Comments

@firebird-issue-importer

Submitted by: @pavel-zotov

window #⁠1:

launch fbsvcmgr in order to trace FB 3.0 SS activity:

/opt/fb30ss/bin/fbsvcmgr localhost/3333:service_mgr user SYSDBA password masterke action_trace_start trc_cfg ./fb30ss_trace.conf

window #⁠2:

Doing with isql only:

game-1:
~~~~~~
/opt/fb30ss/bin/isql localhost/3333:/var/db/fb30/e30.fdb -- OK, it works
quit;
/opt/fb30ss/bin/isql /var/db/fb30/e30.fdb -- OK, it works

Now restart FB and launch again fbsvcmgr in session #⁠1, than return to window #⁠2 and continue:

game-2:
~~~~~~~
/opt/fb30ss/bin/isql /var/db/fb30/e30.fdb

Result: isql will HANG (no matter of was messages about detaching from sec3.fdb appeared in trace window or no).

Now restart FB and launch again fbsvcmgr in session #⁠1, than return to window #⁠2 and continue.

Doing with nbackup (which should use only LOCAL protocol, otherwise we get "PROBLEM ON "nbackup needs local access to database file" / SQLCODE:-999"):

game-3:
~~~~~~~
/opt/fb30ss/bin/nbackup -b 0 /var/db/fb30/e30.fdb ./tmpnbk.nbk0

Result: nbackup will HANG.

This occur only when FB-3 runs in SS architecture.

Commits: 363c0fa FirebirdSQL/fbt-repository@c9edb36

====== Test Details ======

Refactored 08-jan-2016. No need to use NBackup - see comments inside .fbt.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jul 28, 2015

Commented by: @pavel-zotov

PS. trace config:

database =
{
enabled = true
log_sweep = true
log_errors = true
time_threshold = 0
log_connections = true
log_transactions = true
log_statement_start = true

log_statement_finish = true
print_perf = true

}

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Aug 11, 2015

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Aug 12, 2015

Commented by: @hvlad

The issue

1. fbsvcmgr localhost/3333:service_mgr
creates user trace session

2. isql /var/db/fb30/e30.fdb
a) creates *embedded* attachment to the e30.fdb
b) lock Trace Storage Mutex to read info about active trace sessions
c) creates own instance of user trace session object corresponding to (1)
d) attempts to authenticate user name, specified in user trace session (1)
e) attempts to attach to the security database
- embedded attachment failed, as security database already opened by Firebird Server in EX mode
- xnet attachment is started

3. fbserver
a) Firebird Server creates attachment to the security database
b) tries to lock Trace Storage Mutex to read info about active trace sessions

Trace Storage Mutex is already hold by isql (2b), therefore we have livelock condition:
- isql own Trace Storage Mutex and waits for response from fbserver
- fbserver waits for Trace Storage Mutex

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Aug 12, 2015

Commented by: @hvlad

Stack traces

1. isql
> ntdll.dll!NtWaitForSingleObject() Unknown
KernelBase.dll!WaitForSingleObjectEx() Unknown
fbclient.dll!xnet_read(xdr_t * xdrs) Line 1934 C++
fbclient.dll!xnet_getbytes(xdr_t * xdrs, char * buff, unsigned int count) Line 1762 C++
fbclient.dll!GETLONG(xdr_t * xdrs, long * lp) Line 88 C++
fbclient.dll!xdr_enum(xdr_t * xdrs, xdr_op * ip) Line 363 C++
fbclient.dll!xdr_protocol(xdr_t * xdrs, packet * p) Line 285 C++
fbclient.dll!receive(rem_port * main_port, packet * packet) Line 1535 C++
fbclient.dll!rem_port::receive(packet * pckt) Line 660 C++
fbclient.dll!XNET_analyze(ClntAuthBlock * cBlock, const Firebird::StringBaseFirebird::PathNameComparator\ & file_name, bool uv_flag, Firebird::RefPtr<Config> * config, const Firebird::StringBaseFirebird::PathNameComparator\ * ref_db_name) Line 288 C++
fbclient.dll!Remote::analyze(ClntAuthBlock & cBlock, Firebird::StringBaseFirebird::PathNameComparator\ & attach_name, unsigned int flags, Firebird::ClumpletWriter & pb, const ParametersSet & parSet, Firebird::StringBaseFirebird::PathNameComparator\ & node_name, Firebird::StringBaseFirebird::PathNameComparator\ * ref_db_name) Line 5472 C++
fbclient.dll!Remote::RProvider::attach(Firebird::CheckStatusWrapper * status, const char * filename, unsigned int dpb_length, const unsigned char * dpb, bool loopback) Line 800 C++
fbclient.dll!Remote::Loopback::attachDatabase(Firebird::CheckStatusWrapper * status, const char * filename, unsigned int dpb_length, const unsigned char * dpb) Line 865 C++
fbclient.dll!Firebird::IProviderBaseImplRemote::Loopback,Firebird::CheckStatusWrapper,Remote::RProvider\::cloopattachDatabaseDispatcher(Firebird::IProvider * self, Firebird::IStatus * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 8927 C++
fbclient.dll!Firebird::IProvider::attachDatabaseFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 2018 C++
fbclient.dll!Why::Dispatcher::attachOrCreateDatabase(Firebird::CheckStatusWrapper * status, bool createFlag, const char * filename, unsigned int dpbLength, const unsigned char * dpb) Line 5626 C++
fbclient.dll!Why::Dispatcher::attachDatabase(Firebird::CheckStatusWrapper * status, const char * filename, unsigned int dpbLength, const unsigned char * dpb) Line 5542 C++
fbclient.dll!Firebird::IProviderBaseImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::IPluginBaseImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IReferenceCountedImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IVersionedImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::InheritFirebird::IProvider\ > > > > > >::cloopattachDatabaseDispatcher(Firebird::IProvider * self, Firebird::IStatus * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 8927 C++
engine12.dll!Firebird::IProvider::attachDatabaseFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 2018 C++
engine12.dll!Jrd::mapUser(Firebird::StringBaseFirebird::StringComparator\ & name, Firebird::StringBaseFirebird::StringComparator\ & trusted_role, Firebird::StringBaseFirebird::StringComparator\ * auth_method, Firebird::Array<unsigned char,Firebird::EmptyStorage<unsigned char> > * newAuthBlock, const Firebird::Array<unsigned char,Firebird::EmptyStorage<unsigned char> > & authBlock, const char * alias, const char * db, const char * securityAlias, Firebird::ICryptKeyCallback * cryptCb) Line 935 C++
engine12.dll!Jrd::TraceManager::update_session(const Firebird::TraceSession & session) Line 261 C++
engine12.dll!Jrd::TraceManager::update_sessions() Line 194 C++
engine12.dll!Jrd::TraceManager::needs(unsigned int e) Line 126 C++
engine12.dll!Jrd::JProvider::internalAttach(Firebird::CheckStatusWrapper * user_status, const char * filename, unsigned int dpb_length, const unsigned char * dpb, unsigned int internal_flags) Line 1828 C++
engine12.dll!Jrd::JProvider::attachDatabase(Firebird::CheckStatusWrapper * user_status, const char * filename, unsigned int dpb_length, const unsigned char * dpb) Line 1350 C++
engine12.dll!Firebird::IProviderBaseImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::IPluginBaseImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IReferenceCountedImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IVersionedImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::InheritFirebird::IProvider\ > > > > > >::cloopattachDatabaseDispatcher(Firebird::IProvider * self, Firebird::IStatus * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 8927 C++
fbclient.dll!Firebird::IProvider::attachDatabaseFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 2018 C++
fbclient.dll!Why::Dispatcher::attachOrCreateDatabase(Firebird::CheckStatusWrapper * status, bool createFlag, const char * filename, unsigned int dpbLength, const unsigned char * dpb) Line 5626 C++
fbclient.dll!Why::Dispatcher::attachDatabase(Firebird::CheckStatusWrapper * status, const char * filename, unsigned int dpbLength, const unsigned char * dpb) Line 5542 C++
fbclient.dll!Firebird::IProviderBaseImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::IPluginBaseImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IReferenceCountedImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IVersionedImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::InheritFirebird::IProvider\ > > > > > >::cloopattachDatabaseDispatcher(Firebird::IProvider * self, Firebird::IStatus * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 8927 C++
isql.exe!Firebird::IProvider::attachDatabaseFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 2018 C++
isql.exe!newdb(char * dbname, const char * usr, const char * psw, int numbufs, const char * sql_role_nm, bool start_user_trans) Line 7840 C++
isql.exe!do_isql() Line 5505 C++
isql.exe!ISQL_main(int argc, char * * argv) Line 1698 C++
isql.exe!main(int argc, char * * argv) Line 1595 C++
isql.exe!__tmainCRTStartup() Line 626 C
isql.exe!mainCRTStartup() Line 466 C
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown

2. fbserver
KernelBase.dll!WaitForSingleObjectEx() Unknown
engine12.dll!enterFastMutex(Firebird::FAST_MUTEX * lpMutex, unsigned long dwMilliseconds) Line 2712 C++
engine12.dll!ISC_mutex_lock(Firebird::mtx * mutex) Line 2993 C++
engine12.dll!Firebird::SharedMemoryBase::mutexLock() Line 3368 C++
engine12.dll!Jrd::ConfigStorage::acquire() Line 299 C++
engine12.dll!Jrd::StorageGuard::StorageGuard(Jrd::ConfigStorage * storage) Line 171 C++
engine12.dll!Jrd::TraceManager::update_sessions() Line 178 C++
engine12.dll!Jrd::TraceManager::needs(unsigned int e) Line 126 C++
engine12.dll!Jrd::JProvider::internalAttach(Firebird::CheckStatusWrapper * user_status, const char * filename, unsigned int dpb_length, const unsigned char * dpb, unsigned int internal_flags) Line 1828 C++
engine12.dll!Jrd::JProvider::attachDatabase(Firebird::CheckStatusWrapper * user_status, const char * filename, unsigned int dpb_length, const unsigned char * dpb) Line 1350 C++
engine12.dll!Firebird::IProviderBaseImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::IPluginBaseImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IReferenceCountedImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IVersionedImpl<Jrd::JProvider,Firebird::CheckStatusWrapper,Firebird::InheritFirebird::IProvider\ > > > > > >::cloopattachDatabaseDispatcher(Firebird::IProvider * self, Firebird::IStatus * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 8927 C++
fbclient.dll!Firebird::IProvider::attachDatabaseFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 2018 C++
fbclient.dll!Why::Dispatcher::attachOrCreateDatabase(Firebird::CheckStatusWrapper * status, bool createFlag, const char * filename, unsigned int dpbLength, const unsigned char * dpb) Line 5626 C++
fbclient.dll!Why::Dispatcher::attachDatabase(Firebird::CheckStatusWrapper * status, const char * filename, unsigned int dpbLength, const unsigned char * dpb) Line 5542 C++
fbclient.dll!Firebird::IProviderBaseImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::IPluginBaseImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IReferenceCountedImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IVersionedImpl<Why::Dispatcher,Firebird::CheckStatusWrapper,Firebird::InheritFirebird::IProvider\ > > > > > >::cloopattachDatabaseDispatcher(Firebird::IProvider * self, Firebird::IStatus * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 8927 C++
firebird.exe!Firebird::IProvider::attachDatabaseFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, const char * fileName, unsigned int dpbLength, const unsigned char * dpb) Line 2018 C++
firebird.exe!Auth::SrpServer::authenticate(Firebird::CheckStatusWrapper * status, Firebird::IServerBlock * sb, Firebird::IWriter * writerInterface) Line 138 C++
firebird.exe!Firebird::IServerBaseImpl<Auth::SrpServer,Firebird::CheckStatusWrapper,Firebird::IAuthImpl<Auth::SrpServer,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IPluginBaseImpl<Auth::SrpServer,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IReferenceCountedImpl<Auth::SrpServer,Firebird::CheckStatusWrapper,Firebird::Inherit<Firebird::IVersionedImpl<Auth::SrpServer,Firebird::CheckStatusWrapper,Firebird::InheritFirebird::IServer\ > > > > > > > >::cloopauthenticateDispatcher(Firebird::IServer * self, Firebird::IStatus * status, Firebird::IServerBlock * sBlock, Firebird::IWriter * writerInterface) Line 9685 C++
firebird.exe!Firebird::IServer::authenticateFirebird::CheckStatusWrapper\(Firebird::CheckStatusWrapper * status, Firebird::IServerBlock * sBlock, Firebird::IWriter * writerInterface) Line 2351 C++
firebird.exe!accept_connection(rem_port * port, p_cnct * connect, packet * send) Line 1805 C++
firebird.exe!process_packet(rem_port * port, packet * sendL, packet * receive, rem_port * * result) Line 4123 C++
firebird.exe!SRVR_main(rem_port * main_port, unsigned short flags) Line 1166 C++
firebird.exe!service_connection(rem_port * port) Line 544 C++
firebird.exe!process_connection_thread(void * arg) Line 378 C++
firebird.exe!`anonymous namespace'::ThreadArgs::run() Line 77 C++
firebird.exe!threadStart(void * arg) Line 93 C++
msvcr120d.dll!_callthreadstartex() Line 376 C
msvcr120d.dll!_threadstartex(void * ptd) Line 359 C
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Aug 12, 2015

Modified by: @hvlad

Fix Version: 3.0 RC 1 [ 10584 ]

summary: FBSVCMGR with `action_trace_start` prevents in 3.0 SuperServer from connecting using local protocol (in particularly, prevents from doing NBACKUP) => FBSVCMGR with `action_trace_start` prevents in 3.0 SuperServer from connecting using local protocol

Component: NBACKUP [ 10007 ] =>

Component: SVCMGR [ 10141 ] =>

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Aug 12, 2015

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Aug 27, 2015

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

Test Specifics: [Architecture (SS/CS) specific]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 8, 2016

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

Test Specifics: [Architecture (SS/CS) specific] => [Architecture (SS/CS) specific, Platform (Windows/Linux) specific]

Test Details: Refactored 08-jan-2016. No need to use NBackup - see comments inside .fbt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants