Donald Evans
Donald Evans

Reputation: 19

Firebird events

I have written a windows service in .NET 4 that uses the FirebirdSql.Data.FirebirdClient ADO.NET provider v4.5.2.0.

The service depends on capturing events posted by the firebird Db to perform it's tasks.

The code I use to subscribe to the relevant events is:

<!-- language: lang-cs -->
public void SetFirebirdEventListeners()
{
    string[] fbEvents = new string[] { "QueueUpdate", "DispensedSupplyUpdate", "QueueInsert", "DispensedSupplyInsert" };
    try
    {
        fbRemoteEvent = new FbRemoteEvent(fbConn);
        fbRemoteEvent.AddEvents(fbEvents);
        // Add callback to the Firebird events
        fbRemoteEvent.RemoteEventCounts += new FbRemoteEventEventHandler(FbEventHandler);
        // Queue events
        fbRemoteEvent.QueueEvents();
        WriteEventToLog();
    }
    catch (Exception ex)
    {
        log.Error("Error setting firebird event listeners. {0}Message:{1}Stacktrace:{2}", Environment.NewLine + Environment.NewLine, ex.Message + Environment.NewLine, ex.StackTrace);
        throw;
    }
}

The connection to firebird stays open as long as the service is running.

This works fine for a period of time (usually hours), however seemingly at random the service simply stops receiving events. No exceptions are thrown.

Has anyone ever encountered this issue with Firebird and found the cause? I can't see anuthing in the documentation. Is there a way of receiving a warning that the service is no longer subscribed to events?

Upvotes: 2

Views: 1704

Answers (1)

Mark Rotteveel
Mark Rotteveel

Reputation: 108971

You are likely confronted with a race condition in the way Firebird registers and notifies events. This bug will be fixed in Firebird 2.5.8 and Firebird 3.0.3. See CORE-5521 for details.

Upvotes: 1

Related Questions