mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 09:20:39 +01:00
Fixed bug CORE-3170 : Engine could enter infinite loop if EVENT's are posted but no subscribers exists
This commit is contained in:
parent
df245ba88e
commit
6a37e8c261
@ -851,7 +851,7 @@ void DFW_perform_post_commit_work(jrd_tra* transaction)
|
||||
switch (work->dfw_type)
|
||||
{
|
||||
case dfw_post_event:
|
||||
EventManager::init(dbb);
|
||||
EventManager::init(transaction->tra_attachment);
|
||||
|
||||
dbb->dbb_event_mgr->postEvent(lock->lck_length, (const TEXT*) &lock->lck_key,
|
||||
work->dfw_name.length(), work->dfw_name.c_str(),
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "../jrd/os/isc_i_proto.h"
|
||||
#include "../common/utils_proto.h"
|
||||
#include "../jrd/Database.h"
|
||||
#include "../jrd/Attachment.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
@ -74,15 +75,16 @@ GlobalPtr<EventManager::DbEventMgrMap> EventManager::g_emMap;
|
||||
GlobalPtr<Mutex> EventManager::g_mapMutex;
|
||||
|
||||
|
||||
void EventManager::init(Database* dbb)
|
||||
void EventManager::init(Attachment* attachment)
|
||||
{
|
||||
if (!dbb->dbb_event_mgr)
|
||||
Database* dbb = attachment->att_database;
|
||||
EventManager* eventMgr = dbb->dbb_event_mgr;
|
||||
if (!eventMgr)
|
||||
{
|
||||
const Firebird::string id = dbb->getUniqueFileId();
|
||||
|
||||
Firebird::MutexLockGuard guard(g_mapMutex);
|
||||
|
||||
EventManager* eventMgr = NULL;
|
||||
if (!g_emMap->get(id, eventMgr))
|
||||
{
|
||||
eventMgr = new EventManager(id, dbb->dbb_config);
|
||||
@ -92,6 +94,10 @@ void EventManager::init(Database* dbb)
|
||||
|
||||
dbb->dbb_event_mgr = eventMgr;
|
||||
}
|
||||
|
||||
if (!attachment->att_event_session) {
|
||||
attachment->att_event_session = eventMgr->create_session();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -193,7 +199,7 @@ void EventManager::get_shared_file_name(Firebird::PathName& name) const
|
||||
}
|
||||
|
||||
|
||||
SLONG EventManager::createSession()
|
||||
SLONG EventManager::create_session()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
|
@ -36,7 +36,7 @@ class Config;
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
class Database;
|
||||
class Attachment;
|
||||
|
||||
class EventManager : public Firebird::RefCounted, public Firebird::GlobalStorage, public SharedMemory<evh>
|
||||
{
|
||||
@ -48,12 +48,11 @@ class EventManager : public Firebird::RefCounted, public Firebird::GlobalStorage
|
||||
const int PID;
|
||||
|
||||
public:
|
||||
static void init(Database*);
|
||||
static void init(Attachment*);
|
||||
|
||||
EventManager(const Firebird::string& id, Firebird::RefPtr<Config> conf);
|
||||
~EventManager();
|
||||
|
||||
SLONG createSession();
|
||||
void deleteSession(SLONG);
|
||||
|
||||
SLONG queEvents(SLONG, USHORT, const TEXT*, USHORT, const UCHAR*,
|
||||
@ -69,6 +68,7 @@ private:
|
||||
void acquire_shmem();
|
||||
frb* alloc_global(UCHAR type, ULONG length, bool recurse);
|
||||
void create_process();
|
||||
SLONG create_session();
|
||||
void delete_event(evnt*);
|
||||
void delete_process(SLONG);
|
||||
void delete_request(evt_req*);
|
||||
|
@ -2933,12 +2933,7 @@ ISC_STATUS GDS_QUE_EVENTS(ISC_STATUS* user_status,
|
||||
Database* const dbb = tdbb->getDatabase();
|
||||
Lock* const lock = dbb->dbb_lock;
|
||||
|
||||
EventManager::init(dbb);
|
||||
|
||||
if (!attachment->att_event_session)
|
||||
{
|
||||
attachment->att_event_session = dbb->dbb_event_mgr->createSession();
|
||||
}
|
||||
EventManager::init(attachment);
|
||||
|
||||
*id = dbb->dbb_event_mgr->queEvents(attachment->att_event_session,
|
||||
lock->lck_length, (const TEXT*) &lock->lck_key,
|
||||
|
Loading…
Reference in New Issue
Block a user