CSP-12354 - Login after a long inactivity on confluence fails.

Product: Confluence

Environment

Operating System  
Affect Version/s 2.6.0
JVM  
Database MySQL 4.1.x
Application Server Tomcat 5.5.x

Error Message

2007-10-11 09:01:33,925 FATAL [TP-Processor8] [user.provider.jdbc.JDBCCredentialsProvider] handles Could not see if [fver] is handled
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2692)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2621)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1552)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
	at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
	at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
	at com.opensymphony.user.provider.jdbc.JDBCCredentialsProvider.handles(JDBCCredentialsProvider.java:131)
	at bucket.user.providers.ChainedUserProvider.handles(ChainedUserProvider.java:125)

Symptom

The first person that tries to login to confluence in the morning can't (after a 8h+ inactivity on confluence)... He has to wait for about 15 minutes so that he can succesfully login. After that, everybody can login without problem.

Diagnostics/Test

Verify the autoReconnect=true parameter is already set in the db connection url, but the problem still occurs.

Root Cause

The previous db connection is broken (or timeout).

When a database server reboots, or there is a network failure, all the connections in the connection pool are broken, which normally requires a Application Server restart.

However, the Commons DBCP (Database Connection Pool) which is used by the Tomcat application server (and hence JIRA Standalone) can validate connections (by running a simple SQL query) before issuing them, and if a broken connection is detected, a new one is created to replace it. To do this you will need to set the "validationQuery" option on the database connection pool.

Solution

Add validationQuery parameter (set to "SELECT 1") when configuring the datasource in the Catalina/localhost/confluence.xml file.

For example (in Tomcat):

<parameter>
<name>validationQuery</name>
<value>select 1</value>
</parameter>

Alternative solution/workaround:

Increase MySQL's wait_timeout connection via my.cnf/my.ini, or by connecting with a command-line SQL client and entering SET GLOBAL wait_timeout=86400, or some other suitable number of seconds.

Labels

confluence confluence Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.