8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:03:02 +01:00

Backported CORE-6027: Server hang on new attachment right after trace session stop

This commit is contained in:
AlexPeshkoff 2019-04-09 22:13:00 +03:00
parent 0bcf453de9
commit 13d20b54f2
3 changed files with 14 additions and 5 deletions

View File

@ -1087,7 +1087,7 @@ namespace {
#define PTHREAD_ERRNO(x) { int tmpState = (x); if (isPthreadError(tmpState, #x)) return tmpState; }
#define LOG_PTHREAD_ERROR(x) isPthreadError((x), #x)
#define PTHREAD_ERR_STATUS(x, v) { int tmpState = (x); if (tmpState) { error(v, #x, tmpState); return false; } }
#define PTHREAD_ERR_RAISE(x) { int tmpState = (x); if (tmpState) { system_call_failed(#x, tmpState); } }
#define PTHREAD_ERR_RAISE(x) { int tmpState = (x); if (tmpState) { system_call_failed::raise(#x, tmpState); } }
#endif // USE_SHARED_FUTEX
@ -2025,7 +2025,7 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
#ifdef BUGGY_LINUX_MUTEX
}
#endif
#endif
#endif // HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
#ifdef USE_ROBUST_MUTEX
#ifdef BUGGY_LINUX_MUTEX

View File

@ -144,6 +144,8 @@ void ConfigStorage::shutdown()
if (!m_timer)
return;
MutexLockGuard localGuard(m_localMutex, FB_FUNCTION);
m_timer->stop();
m_timer = NULL;
@ -290,6 +292,9 @@ void ConfigStorage::checkFile()
void ConfigStorage::acquire()
{
if (!m_sharedMemory)
(Arg::Gds(isc_random) << "Trace shared memory can not be accessed").raise();
fb_assert(m_recursive >= 0);
const ThreadId currTID = getThreadId();
@ -309,6 +314,8 @@ void ConfigStorage::acquire()
void ConfigStorage::release()
{
fb_assert(m_sharedMemory);
fb_assert(m_recursive > 0);
fb_assert(m_mutexTID == getThreadId());

View File

@ -67,6 +67,9 @@ public:
void release();
void shutdown();
Firebird::Mutex m_localMutex;
private:
void mutexBug(int osErrorCode, const char* text);
bool initialize(Firebird::SharedMemoryBase*, bool);
@ -163,12 +166,11 @@ public:
};
class StorageGuard
class StorageGuard : public Firebird::MutexLockGuard
{
public:
explicit StorageGuard(ConfigStorage* storage) :
m_storage(storage)
Firebird::MutexLockGuard(storage->m_localMutex, FB_FUNCTION), m_storage(storage)
{
m_storage->acquire();
}