RE: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

"Mark Matthews" <[email protected]> Tue, 29 May 2007 15:53:52 -0500
Newsgroups gmane.comp.db.mysql.java
Message-ID <006201c7a233$789549f0$9c1da8c0@marksworkbox>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



> -----Original Message-----
> From: Andreas Andersson [mailto:[email protected]] 
> Sent: Tuesday, May 29, 2007 3:47 PM
> To: Mark Matthews
> Cc: [email protected]
> Subject: Re: com.mysql.jdbc.CommunicationsException: 
> Communications link failure due to underlying exception:
> 
> Mark Matthews wrote:
> 
> > Andreas,
> >
> > --log-warnings on the server should give you some more insight.
> >
> > Is there anything in your application (GC?) that could be causing a 
> > hiccup that would cause login_timeout to expipre? The 
> server will kill 
> > a connection in the authentication phase if that timeout expires.
> It shouldn't be anything like GC, it's been running smooth on 
> the old connector for a long time.
> 
> I added the parameter dontTrackOpenResources=true and that 
> seems to have solved this problem. Good, but a bit confusing :)

Hi Andreas,

It seems maybe that you've _masked_ the problem, not solved it :(

This configuration parameter usually only helps if the application leaks statements and/or result sets like a sieve. Earlier versions of the JDBC specification made a claim that non-used resources would be cleaned up via GC if they weren't explicitly closed. It turns out this doesn't work in practice so that claim has been removed (finally) in JDBC-4.0 (ask me if you want the long-winded explanation, but the short version is along the lines of non-deterministic sometimes parallel GC and interacting with a server on the other end of the network that usually requires synchronization for communication doesn't work well). 

If I had to guess, what was going on was that your VM was in the middle of a big GC of these "abandoned" statements and/or result sets and login_timeout was exceeded. 

Setting "useUsageAdvisor=true" and running through your application a little bit should show you if this is the case. Alternatively, either PMD of FindBugs will find code that it suspects leaves database resources laying around.

	-Mark
- -- 
Mark Matthews, Architect (Client Connectivity)
MySQL, Inc. Chicago, USA - www.mysql.com 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)

iD8DBQFGXJLgtvXNTca6JD8RAiIGAKCChSuvP0Aru7JVNY/b4EoiTu1xXQCgmjbp
t3E5nvwumYiy9tEQovQngFQ=
=BqEG
-----END PGP SIGNATURE-----


-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]