Page 1 of 1

Wrong implementation of IDbConnection.State

Posted: Thu 18 Aug 2011 12:17
by iouri.bespalov
Tested with 3 versions including the latest one.

example:

public override bool IsOpen()
{
bool bPing = false;
try {
bPing = ( (OracleConnection)this.conn ).Ping();
}
catch {
bPing = false;
}
return bPing;
// return ( this.conn.State == ConnectionState.Open );
}

I expect that after a round trip to the database with exception such as ORA-12537 connection closed the state change to ConnectionState.Closed or ConnectionState.Brocken. As for example in odp or ado implemented.

In Your solution it plays no role: is this adirect or indirect connection, the state is Open.

Please fix this

Addition:

Trace of Your Ping():
-----------------------------------------------
Timestamp: 18.08.2011 14:03:10
begin null; end;
Elapsed time: 0.001
--------------------------------------------------------------------------------
Timestamp: 18.08.2011 14:03:11
begin null; end;
Elapsed time: 0.001
---------------------------------------------------

So let's calculate
0.001 seconds for each round trip.
if we need to send Ping() before, we say, 1.000.000 calls to the database
we get 1.000.000 x 0.001 = 1000 sec.
1000 seconds = 16,(6) minutes of time that we lose.

than we say that needed select, update,insert or delete use 0.006 sec
so
1.000.000 x 0.006 = 6000 sec = 100 minutes

so we need additional 16,(6) % of time to execute.

It's NO GO

Posted: Thu 18 Aug 2011 13:16
by Shalex
We have reproduced the behaviour when the ConnectionState.Open is not changed to Closed or Broken when OracleConnection.Ping() returns false. We will investigate the issue and notify you about the results as soon as possible. And we have asked you by e-mail for an additional information about the situation when OracleConnection.Ping() raises an exception.

Posted: Fri 19 Aug 2011 06:27
by iouri.bespalov
The change of ConnectionState should also change on every Execution with network Exception, not only on using of Ping().

Posted: Fri 19 Aug 2011 10:16
by Shalex
Thank you for your suggestion. We will investigate the possibility of implementing this behaviour.