From: Tedd <te...@al...> - 2002-12-03 13:37:40
|
Carlos, This change has fixed certain instances of the problem but it appears that there are cases where this still won't work. There are two different things that go wrong. My only guess is that it depends on what stage a transaction was in and whether the statements tied to the transaction were currently running. I will respond again with specific line numbers and error messages where the problem appears. I will also try to pin down exactly what state the commands and transactions are in when the database connection is lost. When I asked about events I was referring to implementing the isc_que_events and isc_wait_event api functions. Tedd -----Original Message----- From: fir...@li... [mailto:fir...@li...]On Behalf Of Carlos Guzma'n A'lvarez Sent: Wednesday, November 27, 2002 2:20 AM To: fir...@li... Subject: Re: [Firebird-net-provider] How to reset transaction after connection drop? Hello: > I am writing a windows service that is basically polling a firebird > database. In the past I have had some difficulty with the database > periodically crashing. So, I am trying to make my service gracefully > handle > a database crash. > > The service itself reuses a series of FbCommand objects each time a Timer > event fires. But, I haven't found a way to recover the FbCommand objects > that have active transactions to allow them to be used with the new > database > connection. As far as I can tell, any attempt to associate a new > FbConnection object with the FbCommand objects causes a rollback on the > existing transaction. This obviously fails since the original > connection is > no longer valid. Is there a way to recover these command objects or > should > I instantiate new ones and let the old ones be garbage collected? Can you try with latest cvs sources i have commited a fix for it yet. > Has anyone started working on enabling events? I know that my service > would > be a whole lot more efficient if I could use an event model as apposed to > polling the database. If anybody is working on it, I'd be glad to > help. If > not, I'll look into it myself. No, to which events are you referring??, (now there are events enabled on FbConnection class for StateChange of connection and info messages sent by firebird server, and there are events on FbDataAdapter for data updating). Best regards Carlos Guzma'n A'lvarez Vigo-Spain --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.423 / Virus Database: 238 - Release Date: 11/25/2002 |
From:
<car...@te...> - 2002-12-03 14:54:57
|
Hello: > Carlos, > > This change has fixed certain instances of the problem but it appears that > there are cases where this still won't work. There are two different things > that go wrong. My only guess is that it depends on what stage a transaction > was in and whether the statements tied to the transaction were currently > running. > > I will respond again with specific line numbers and error messages where the > problem appears. I will also try to pin down exactly what state the > commands and transactions are in when the database connection is lost. > Ok. > When I asked about events I was referring to implementing the isc_que_events > and isc_wait_event api functions. > Ok, i have no plans for make this at this moment, but if you wish to implement it i can try to help you. Best regards Carlos Guzma'n A'lvarez Vigo-Spain |
From: Tedd <te...@al...> - 2002-12-06 23:39:14
|
I have tracked down why I was having difficulty using FbConnections after the database is shutdown and restarted. The problem results from the way I am using FbConnection objects. When using connection pooling, when FbConnection.Open()is called, a connection is retrieved from the unlocked pool. There currently is no method in place to check the validity of this connection. In the event Firebird restarts, the connection looks valid and its state is set to Open. However, any operation on this connection, such as BeginTransaction() throws an exception. Since I always Close() the connection object after use, FbConnectionPool.CheckIn() modifies the created ticks to 'now'. This means that the connection is never 'Expired', so the underlying 'old' FbIscConnection is never closed. Any attempt to create a new connection pulls the old invalid FbIscConnection from the unlocked pool. Solutions: First, do not 'Close()' an FbConnection where a 335544721 isc_network_error exception was thrown, even if its state is 'Open'. This prevents the connection from being put back into the unlocked pool. However, I am just not comfortable leaving an 'Open' connection hang around like that. It is still in the locked pool so it will never be GC'd Second, FbConnectionPool.CheckOut() should verify that a connection pulled from the unlocked pool is, indeed, valid. FbConnection.Open()|FbConnectionPool.CheckOut() should never return an invalid connection, especially if when looks valid. I have modified FbConnectionPool and FbIscConnection to handle this. I added a function to FbIscConnection that verifies the validity of the connection by calling gds.isc_database_info(). No database info is actually retrieved. I am only interested in showing that I can communicate with the database. The function returns true or false depending on the validity. The modification to FbConnectionPool is to call the FbIscConnection verification function after pulling a connection from the unlocked pool. If the connection is not valid, it is expired. There are some things I'd like change about the mods but it might mean more changes to FbIscConnection that I'm comfortable making at this point. Mostly, I think that the verification function should be static. If anybody is interested, let me know how to send the modifications. Lastly, it would be nice if we could set the maximum lifetime of a connection. FbConnectionPool would not return a FbIscConnection older than the maximum lifetime. I'm not sure how this coincides with Microsoft's existing database classes. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.423 / Virus Database: 238 - Release Date: 11/25/2002 |
From:
<car...@te...> - 2002-12-07 00:13:17
|
Hello: > > If anybody is interested, let me know how to send the modifications. > You can send patches using cvs diff -u, or send the files and i will make the cvs diff. > Lastly, it would be nice if we could set the maximum lifetime of a > connection. FbConnectionPool would not return a FbIscConnection older than > the maximum lifetime. I'm not sure how this coincides with Microsoft's > existing database classes. I can try to see this on Microsoft Documentation. Best regards Carlos Guzmán Álvarez vigo-Spain |
From: Gia T. <jj...@ho...> - 2002-12-10 12:10:44
|
I dont believe its a good idea to set a time out for connections (maybe there could be an option for that at runtime). "Carlos Guzmán Álvarez" <car...@te...> wrote in message news:3DF...@te...... > Hello: > > > > > If anybody is interested, let me know how to send the modifications. > > > > You can send patches using cvs diff -u, or send the files and i will > make the cvs diff. > > > Lastly, it would be nice if we could set the maximum lifetime of a > > connection. FbConnectionPool would not return a FbIscConnection older than > > the maximum lifetime. I'm not sure how this coincides with Microsoft's > > existing database classes. > > I can try to see this on Microsoft Documentation. > > > > > Best regards > Carlos Guzmán Álvarez > vigo-Spain > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > |
From: <car...@te...> - 2002-12-10 12:22:57
|
Hello: > > I can try to see this on Microsoft Documentation. > All i found on this is that on SqlClient if you put lifetime to 0 this will get the maximum lifetime but i don´t found a value for max lifetime . Best regards Carlos Guzmán Álvarez Vigo-Spain |