You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Donald Ball <ba...@webslingerZ.com> on 2001/04/23 19:11:39 UTC

[c2] still problem with datasources

fwiw, i'm still having problems with the datasource manager not noticing
connection timeout until after it's given me a stale connection.

- donald


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [c2] still problem with datasources

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 23 Apr 2001, Santiago Gala wrote:

> >> fwiw, i'm still having problems with the datasource manager not noticing
> >> connection timeout until after it's given me a stale connection.
> >
> >
> > Ok.  I am checking the isClosed() to see if the connection is stale.  Is there
> > anything else I should check?
> >
>
> I think this will not work always.
>
> I seem to remember having seen code somewhere that actually called a
> PerparedStatement containing "SELECT 1" to check if there was any
> problem with the actual socket connection. This can be done in the
> background every so and so time or before giving it to the requester...
>
> I'm not sure it is a good solution, but it could be a strategy that is
> configured for buggy drivers or buggy databases.

man, you're so right, i have run into this before. attached is a patch for
the avalon JdbcConnection class that might take care of this.

- donald

Re: [c2] still problem with datasources

Posted by Santiago Gala <sg...@hisitech.com>.
Berin Loritsch wrote:

> Donald Ball wrote:
> 
>> fwiw, i'm still having problems with the datasource manager not noticing
>> connection timeout until after it's given me a stale connection.
> 
> 
> Ok.  I am checking the isClosed() to see if the connection is stale.  Is there
> anything else I should check?
> 

I think this will not work always.

I seem to remember having seen code somewhere that actually called a 
PerparedStatement containing "SELECT 1" to check if there was any 
problem with the actual socket connection. This can be done in the 
background every so and so time or before giving it to the requester...

I'm not sure it is a good solution, but it could be a strategy that is 
configured for buggy drivers or buggy databases.

I'm looking at the postgres implementation (what I have at hand, not 
latest and greatest), and isClosed() will work if the closing occurs in 
the java side (i.e., the user closed the connection before returning it 
back), but it will fail if the close took place in the server side, as 
the driver never probes the actual socket. In fact, if any IOException 
is returned because the socket was closed, the connection will remain 
broken until you discard the socket by closing it. In general it is 
difficult, unless the JDBC driver/DB protocol has a keep-alive 
mechanism, to ensure that java will notice server closing unless you 
actually try to send something down the wire.


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [c2] still problem with datasources

Posted by Berin Loritsch <bl...@apache.org>.
Donald Ball wrote:
> 
> On Mon, 23 Apr 2001, Berin Loritsch wrote:
> 
> > > fwiw, i'm still having problems with the datasource manager not noticing
> > > connection timeout until after it's given me a stale connection.
> >
> > Ok.  I am checking the isClosed() to see if the connection is stale.  Is there
> > anything else I should check?
> 
> not that i can think of offhand. is the check for isClosed in the current
> avalon with cocoon or in cvs?

it should be in the current avalon with cocoon.  I will double-check the code
placement to see if it is bypassed in some circumstances.

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [c2] still problem with datasources

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 23 Apr 2001, Berin Loritsch wrote:

> > fwiw, i'm still having problems with the datasource manager not noticing
> > connection timeout until after it's given me a stale connection.
>
> Ok.  I am checking the isClosed() to see if the connection is stale.  Is there
> anything else I should check?

not that i can think of offhand. is the check for isClosed in the current
avalon with cocoon or in cvs?

- donald


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [c2] still problem with datasources

Posted by Berin Loritsch <bl...@apache.org>.
Donald Ball wrote:
> 
> fwiw, i'm still having problems with the datasource manager not noticing
> connection timeout until after it's given me a stale connection.

Ok.  I am checking the isClosed() to see if the connection is stale.  Is there
anything else I should check?

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org