Skip to content

Commit

Permalink
Frontported fix for CORE-3532: Server hangs starting new session when…
Browse files Browse the repository at this point in the history
… trace is running
  • Loading branch information
AlexPeshkoff committed Oct 13, 2011
1 parent def8abe commit 5aae503
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/jrd/trace/TraceConfigStorage.cpp
Expand Up @@ -80,7 +80,8 @@ void checkFileError(const char* filename, const char* operation, ISC_STATUS iscE
}

ConfigStorage::ConfigStorage()
: timer(new TouchFile)
: timer(new TouchFile),
m_recursive(0)
{
m_cfg_file = -1;
m_dirty = false;
Expand Down Expand Up @@ -284,13 +285,23 @@ void ConfigStorage::checkFile()

void ConfigStorage::acquire()
{
mutexLock();
fb_assert(m_recursive >= 0);

if (m_recursive++ == 0)
{
mutexLock();
}
}

void ConfigStorage::release()
{
checkDirty();
mutexUnlock();
fb_assert(m_recursive > 0);

if (--m_recursive == 0)
{
checkDirty();
mutexUnlock();
}
}

void ConfigStorage::addSession(TraceSession& session)
Expand Down
1 change: 1 addition & 0 deletions src/jrd/trace/TraceConfigStorage.h
Expand Up @@ -116,6 +116,7 @@ class ConfigStorage : public Firebird::GlobalStorage, public SharedMemory<TraceC
void putItem(ITEM tag, ULONG len, const void* data);
bool getItemLength(ITEM& tag, ULONG& len);

int m_recursive;
int m_cfg_file;
bool m_dirty;
};
Expand Down

0 comments on commit 5aae503

Please sign in to comment.