OracleAlerter stops receiving alerts after couple of hours

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
pavel.tupitsin
Posts: 5
Joined: Thu 19 May 2011 14:45

OracleAlerter stops receiving alerts after couple of hours

Post by pavel.tupitsin » Thu 02 Jun 2011 15:29

We have long-running web application which should always listen to database alerts. The code is following:

Code: Select all

                  oracleAlerter = new OracleAlerter(connection, AlertName);
                  oracleAlerter.Alert += AlertHandler;
                  oracleAlerter.Stopped += OracleAlerterStopped;
                  oracleAlerter.Error += OracleAlerterError;
                  oracleAlerter.WaitTimeout += OracleAlerterWaitTimeout;
                  oracleAlerter.Timeout = int.MaxValue;
                  oracleAlerter.Interval = 0;
                  oracleAlerter.Start();
I reconnect alerter once a day, but after some period of time (2-3 hours) it stops receiving alerts. No event is raised (Error, WaitTimeout, Stopped). Active property returns true.

What can be the reason? Is there a way to have long-running listener which is guarantied to receive alerts?

Shalex
Site Admin
Posts: 8239
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 03 Jun 2011 13:00

1. Please set oracleAlerter.Timeout to 86400000. This is a max value (the higer values are ignored at the moment - we will correct this behaviour).
2. How does your alert generator look like? Does it continue generate alerters after your application stopped receiving them? Also please check Oracle logs if there are any problems on the server at that moment.
3. Perhaps, it can be a problem with physical connection. Try playing with setting the "Direct=true/false;" and "Pooling=true/false;" connection string parameters to check if it helps. Make sure there are no any connection timeouts in dotConnect for Oracle (set "Connection Timeout" and "Connection Lifetime" to zero), Oracle client, and Oracle server.
4. Try to work around the issue be recreating OracleAlerter each hour.

pavel.tupitsin
Posts: 5
Joined: Thu 19 May 2011 14:45

Post by pavel.tupitsin » Mon 06 Jun 2011 10:15

1. ok
2. Alerts are generated by triggers in the database (on insert/update/delete)
We use alerts to invalidate application cache.
3. Yes, the network can be unstable sometimes. I have a keep-alive timer which checks alerter state periodically. The problem is that OracleAlerter reports to be Active and do not produce any events when connection is lost.
Direct=true is the only option for us.
4. Already done this, but this still cannot guarantee that for some period of time alerts will not be missed.

Again, main problem is that I cannot detect failed alerter. There could be network problems and I need to react properly (drop caches and tell user, etc), but OracleAlerter behaves like everything is ok even if I unplug the cable.

Shalex
Site Admin
Posts: 8239
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 09 Jun 2011 10:21

pavel.tupitsin wrote:3. Yes, the network can be unstable sometimes. I have a keep-alive timer which checks alerter state periodically. The problem is that OracleAlerter reports to be Active and do not produce any events when connection is lost.
Direct=true is the only option for us.
Try also checking the workability of OracleAlerter's connection object by invoking its Ping() method that makes a real round trip on Oracle server to validate the connection state.

Post Reply