Skip to content

Commit

Permalink
Fixed #7809: Crash "Fatal lock manager error: Process disappeared in …
Browse files Browse the repository at this point in the history
…LockManager::acquire_shmem"

(cherry picked from commit 3dba22b)
  • Loading branch information
AlexPeshkoff committed Dec 5, 2023
1 parent bd40df2 commit 3dc03dd
Show file tree
Hide file tree
Showing 2 changed files with 256 additions and 414 deletions.
23 changes: 8 additions & 15 deletions src/common/isc_s_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ class MemoryHeader
#define USE_FCNTL
#endif

class CountedFd;
class CountedRWLock;
class SharedFileInfo;

class FileLock
{
Expand All @@ -191,8 +190,8 @@ class FileLock
enum LockMode {FLM_EXCLUSIVE, FLM_TRY_EXCLUSIVE, FLM_SHARED};

typedef void InitFunction(int fd);
explicit FileLock(const char* fileName, InitFunction* init = NULL); // main ctor
FileLock(const FileLock* main, int s); // creates additional lock for existing file

explicit FileLock(const char* fileName, InitFunction* init = NULL);
~FileLock();

// Main function to lock file
Expand All @@ -201,24 +200,18 @@ class FileLock
// Alternative locker is using status vector to report errors
bool setlock(Firebird::CheckStatusWrapper* status, const LockMode mode);

// unlocking can only put error into log file - we can't throw in dtors
// Unlocking can only put error into log file - we can't throw in dtors
void unlock();

// Obvious access to file descriptor
int getFd();

private:
enum LockLevel {LCK_NONE, LCK_SHARED, LCK_EXCL};

private:
Firebird::RefPtr<SharedFileInfo> file;
InitFunction* initFunction;
LockLevel level;
CountedFd* oFile;
#ifdef USE_FCNTL
int lStart;
#endif
class CountedRWLock* rwcl; // Due to order of init in ctor rwcl must go after fd & start

Firebird::string getLockId();
class CountedRWLock* getRw();
void rwUnlock();
};

#endif // UNIX
Expand Down
Loading

0 comments on commit 3dc03dd

Please sign in to comment.