geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: MySQL Broken Pipe
Date Sun, 06 Dec 2009 01:54:50 GMT
Connections sometimes break, and the question is how to deal with it.

When your app is using a connection and it breaks you pretty much have  
to start your unit of work over again.  There's no way around this,  
and it needs to be part of your app design.

Internally, what is supposed to happen is that the connection pool  
detects that the connection is broken when you try to use it and  
discards it., so your app will never again get the broken connection.

Depending on how you get connections, there may or may not be a built  
in way to be notified by the db-specific driver code when a fatal  
error has occurred on a connection.  We've upgraded our support for  
this a lot in geronimo 2.2 which will hopefully be released very  
soon.... although I've been saying this for a long time.  However,  
your best bet is to upgrade and see if that fixes the problem.

thanks
david jencks

On Dec 5, 2009, at 9:32 AM, ericp56 wrote:

>
> Hello,
>
> I have a problem with the MySQL 3.1.12 connector.  I occasionally get
> "broken pipe" exceptions, and have to reset the J2EE connector to  
> resolve
> it.
>
> I see that I can set a "autoReconnect" parameter in the JDBC URL to  
> resolve
> this.
>
> 1.  Since the db pool wizard doesn't offer anything for parameters,  
> can I
> add an "autoReconnect" element to the deployment plan and deploy it  
> that
> way?
>
> 2.  From the MySQL documentation:
> autoReconnect - Should the driver try to re-establish stale and/or  
> dead
> connections? If enabled the driver will throw an exception for a  
> queries
> issued on a stale or dead connection, which belong to the current
> transaction, but will attempt reconnect before the next query issued  
> on the
> connection in a new transaction. The use of this feature is not  
> recommended,
> because it has side effects related to session state and data  
> consistency
> when applications don't handle SQLExceptions properly, and is only  
> designed
> to be used when you are unable to configure your application to handle
> SQLExceptions resulting from dead and stale connections properly.
> Alternatively, investigate setting the MySQL server variable  
> "wait_timeout"
> to some high value rather than the default of 8 hours.
>
> I imagine there is no graceful way to handle this in our  
> applications, and
> resetting the DB pool/connector is the only way to resolve it right  
> now, so
> although they advise against it, #1 is the way to handle it, and not  
> #2.
>
> Any thoughts?
>
> Thanks,
> Eric
>
> The connections occasionally break, and the solution I see in MySQL  
> forums
> is to add a parameter to the JDBC URL:
> jdbc:mysql://(host):(port)/(db_name)?autoReconnect=true
>
> The problem is, in the Geronimo DB pool wizard (2.1.4), there is no  
> way to
> set the URL.
>
> Can I modify the wizard's deployment plan and add in an element to  
> handle
> this?
>
> Thanks,
>
> Eric
> -- 
> View this message in context: http://old.nabble.com/MySQL-Broken-Pipe-tp26657535s134p26657535.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message