Troubles with database communication

From time to time my DHIS stalls and report me this:

···

=========================================================
Jun 23, 2010 5:15:53 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC beg
in failed:
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy72.loadUserByUsername(Unknown Source)
    at org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

    at org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
    at org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

    at org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
    at org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

    at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
    at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:636)

Caused by: org.hibernate.TransactionException: JDBC begin failed:
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

    at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
    ... 36 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
at sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)

    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
    at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

    at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
    at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
    ... 38 more

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
    ... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is a dhis user connected:

=========================================================

[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1346
Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

status


mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64) using readline 5.1

Connection id: 1346
Current database:
Current user: dhis@localhost

SSL: Not in use
Current pager: stdout
Using outfile: ‘’
Using delimiter: ;
Server version: 5.1.30-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket

Server characterset: utf8
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush tables: 1 Open tables: 511 Queries per second avg: 0.152

show processlist;
±-----±-----±----------------±--------±--------±-----±------±-----------------+

Id | User | Host | db | Command | Time | State | Info |
±-----±-----±----------------±--------±--------±-----±------±-----------------+
1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | | NULL |

1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | | NULL |
1346 | dhis | localhost | NULL | Query | 0 | NULL | show processlist |
±-----±-----±----------------±--------±--------±-----±------±-----------------+

3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).
My JAVA_OPTS=“-Xms128m -Xmx700m -XX:MaxPermSize=256m”

I am on Fedora Linux: Fedora release 10 (Cambridge)
And Tomcat 6.0.18.

Can you help me guys?

Caveman

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?

Regards,
Jason

···

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto <orvaquim@gmail.com> wrote:

>From time to time my DHIS stalls and report me this:

Jun 23, 2010 5:15:53 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
org.springframework.transaction.CannotCreateTransactionException: Could not
open Hibernate Session for transaction; nested exception is
org.hibernate.TransactionException: JDBC beg
in failed:
at
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy72.loadUserByUsername(Unknown Source)
at
org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
at
org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
at
org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
at
org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
at
org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
at
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:636)
Caused by: org.hibernate.TransactionException: JDBC begin failed:
at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
... 36 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure

Last packet sent to the server was 0 ms ago.
at sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown
Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
at
com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
at
com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
... 38 more
Caused by: java.io.EOFException: Can not read response from server. Expected
to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is a dhis
user connected:

=========================================================
[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1346
Server version: 5.1.30-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

> status
--------------
mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64) using
readline 5.1

Connection id: 1346
Current database:
Current user: dhis@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.30-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush tables:
1 Open tables: 511 Queries per second avg: 0.152
--------------

> show processlist;
+------+------+-----------------+---------+---------+------+-------+------------------+
> Id | User | Host | db | Command | Time | State |
Info |
+------+------+-----------------+---------+---------+------+-------+------------------+
> 1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |
NULL |
> 1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |
NULL |
> 1346 | dhis | localhost | NULL | Query | 0 | NULL | show
processlist |
+------+------+-----------------+---------+---------+------+-------+------------------+
3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).
My JAVA_OPTS="-Xms128m -Xmx700m -XX:MaxPermSize=256m"

I am on Fedora Linux: Fedora release 10 (Cambridge)
And Tomcat 6.0.18.

Can you help me guys?

Caveman

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

--
--
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+260968395190

I can see from the status message that unix domain sockets are being
used by the mysql client. Your hibernate connection will use tcp/ip.

The problem seems definitely to be with the transport layer -
"Expected to read 4 bytes, read 0 bytes before connection was
unexpectedly lost". So the socket channel definitely goes bad on you
:frowning:

Orvalho is this problem completely random or can you think is there
any pattern to it? For example I have seen a problem with mysql if
you are doing a very large import and the size of the mysql packet
(with all the multiple inserts) exceeds a hard limit - there is a
setting to increase this. But from what you are saying (from time to
time) I don't think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards
Bob

···

On 23 June 2010 07:09, Jason Pickering <jason.p.pickering@gmail.com> wrote:

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?

Regards,
Jason

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto <orvaquim@gmail.com> wrote:

>From time to time my DHIS stalls and report me this:

Jun 23, 2010 5:15:53 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
org.springframework.transaction.CannotCreateTransactionException: Could not
open Hibernate Session for transaction; nested exception is
org.hibernate.TransactionException: JDBC beg
in failed:
at
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy72.loadUserByUsername(Unknown Source)
at
org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
at
org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
at
org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
at
org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
at
org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
at
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:636)
Caused by: org.hibernate.TransactionException: JDBC begin failed:
at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
... 36 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure

Last packet sent to the server was 0 ms ago.
at sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown
Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at
com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
at
com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
at
com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
... 38 more
Caused by: java.io.EOFException: Can not read response from server. Expected
to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is a dhis
user connected:

=========================================================
[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1346
Server version: 5.1.30-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

> status
--------------
mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64) using
readline 5.1

Connection id: 1346
Current database:
Current user: dhis@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.30-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush tables:
1 Open tables: 511 Queries per second avg: 0.152
--------------

> show processlist;
+------+------+-----------------+---------+---------+------+-------+------------------+
> Id | User | Host | db | Command | Time | State |
Info |
+------+------+-----------------+---------+---------+------+-------+------------------+
> 1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |
NULL |
> 1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |
NULL |
> 1346 | dhis | localhost | NULL | Query | 0 | NULL | show
processlist |
+------+------+-----------------+---------+---------+------+-------+------------------+
3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).
My JAVA_OPTS="-Xms128m -Xmx700m -XX:MaxPermSize=256m"

I am on Fedora Linux: Fedora release 10 (Cambridge)
And Tomcat 6.0.18.

Can you help me guys?

Caveman

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

--
--
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+260968395190

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

Sorry for my laziness on this.

My hibernate.properties

hibernate.dialect = org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class = com.mysql.jdbc.Driver
##hibernate.connection.url = jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.url = jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8
hibernate.connection.username = dhis
hibernate.connection.password = dhis
hibernate.hbm2ddl.auto = update

By this you are right. I am using unix socket when setting with localhost on URL. I must write 127.0.0.1.

I have changed and I am waiting to see it again.

This happened not only with importing and etc… it happened on the login too.

Thank you
Caveman

···

On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe bobjolliffe@gmail.com wrote:

I can see from the status message that unix domain sockets are being

used by the mysql client. Your hibernate connection will use tcp/ip.

The problem seems definitely to be with the transport layer -
"Expected to read 4 bytes, read 0 bytes before connection was

unexpectedly lost". So the socket channel definitely goes bad on you

:frowning:

Orvalho is this problem completely random or can you think is there

any pattern to it? For example I have seen a problem with mysql if

you are doing a very large import and the size of the mysql packet

(with all the multiple inserts) exceeds a hard limit - there is a

setting to increase this. But from what you are saying (from time to

time) I don’t think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards

Bob

On 23 June 2010 07:09, Jason Pickering jason.p.pickering@gmail.com wrote:

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?

Regards,

Jason

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto orvaquim@gmail.com wrote:

From time to time my DHIS stalls and report me this:

=========================================================

Jun 23, 2010 5:15:53 AM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet default threw exception

org.springframework.transaction.CannotCreateTransactionException: Could not

open Hibernate Session for transaction; nested exception is

org.hibernate.TransactionException: JDBC beg

in failed:

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

    at

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

    at

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

    at

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

    at

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

    at

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

    at $Proxy72.loadUserByUsername(Unknown Source)
    at

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

    at

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

    at

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

    at

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

    at

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

    at

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

    at

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

    at

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

    at

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

    at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    at

org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:636)

Caused by: org.hibernate.TransactionException: JDBC begin failed:

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

    at

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

    ... 36 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

Communications link failure

Last packet sent to the server was 0 ms ago.

    at sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown

Source)

    at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at

com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
    at

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

    at

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

    ... 38 more

Caused by: java.io.EOFException: Can not read response from server. Expected

to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
    ... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is a dhis

user connected:

=========================================================

[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1346

Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

status


mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64) using

readline 5.1

Connection id: 1346

Current database:

Current user: dhis@localhost

SSL: Not in use

Current pager: stdout

Using outfile: ‘’

Using delimiter: ;

Server version: 5.1.30-log MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db characterset: utf8

Client characterset: latin1

Conn. characterset: latin1

UNIX socket: /var/lib/mysql/mysql.sock

Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush tables:

1 Open tables: 511 Queries per second avg: 0.152


show processlist;

±-----±-----±----------------±--------±--------±-----±------±-----------------+

Id | User | Host | db | Command | Time | State |

Info |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |

NULL |

1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |

NULL |

1346 | dhis | localhost | NULL | Query | 0 | NULL | show

processlist |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).

My JAVA_OPTS=“-Xms128m -Xmx700m -XX:MaxPermSize=256m”

I am on Fedora Linux: Fedora release 10 (Cambridge)

And Tomcat 6.0.18.

Can you help me guys?

Caveman


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+260968395190


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Sorry for my laziness on this.

My hibernate.properties

hibernate.dialect = org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class = com.mysql.jdbc.Driver
##hibernate.connection.url =
jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8
hibernate.connection.url =
jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8
hibernate.connection.username = dhis
hibernate.connection.password = dhis
hibernate.hbm2ddl.auto = update

By this you are right. I am using unix socket when setting with localhost on
URL. I must write 127.0.0.1.

I have changed and I am waiting to see it again.

The unix domain socket is a bit of a distraction as java does not
support unix domain sockets so the hibernate connection will always be
tcp anyway. So waiting will not help :slight_smile:

This happened not only with importing and etc... it happened on the login
too.

I have seen reports of certain mixtures of jdbc drivers and versions
causing problems. You might want to check that against other
experiences on google.

Regards
Bob

···

On 23 June 2010 18:00, Orvalho Augusto <orvaquim@gmail.com> wrote:

Thank you
Caveman

On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

I can see from the status message that unix domain sockets are being
used by the mysql client. Your hibernate connection will use tcp/ip.

The problem seems definitely to be with the transport layer -
"Expected to read 4 bytes, read 0 bytes before connection was
unexpectedly lost". So the socket channel definitely goes bad on you
:frowning:

Orvalho is this problem completely random or can you think is there
any pattern to it? For example I have seen a problem with mysql if
you are doing a very large import and the size of the mysql packet
(with all the multiple inserts) exceeds a hard limit - there is a
setting to increase this. But from what you are saying (from time to
time) I don't think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards
Bob

On 23 June 2010 07:09, Jason Pickering <jason.p.pickering@gmail.com> >> wrote:
> Can you send your hibernate.properties file (otherwise privately)?
>
> Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?
>
> Regards,
> Jason
>
>
> On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto <orvaquim@gmail.com> >> > wrote:
>> >From time to time my DHIS stalls and report me this:
>> =========================================================
>> Jun 23, 2010 5:15:53 AM org.apache.catalina.core.StandardWrapperValve
>> invoke
>> SEVERE: Servlet.service() for servlet default threw exception
>> org.springframework.transaction.CannotCreateTransactionException: Could
>> not
>> open Hibernate Session for transaction; nested exception is
>> org.hibernate.TransactionException: JDBC beg
>> in failed:
>> at
>>
>> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
>> at
>>
>> org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
>> at
>>
>> org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
>> at
>>
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
>> at
>>
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> at
>>
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> at $Proxy72.loadUserByUsername(Unknown Source)
>> at
>>
>> org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
>> at
>>
>> org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
>> at
>>
>> org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
>> at
>>
>> org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
>> at
>>
>> org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
>> at
>>
>> org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
>> at
>>
>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>> at
>>
>> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
>> at
>>
>> org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
>> at
>>
>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>> at
>>
>> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
>> at
>>
>> org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
>> at
>>
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
>> at
>>
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
>> at
>>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> at
>>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> at
>>
>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> at
>>
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> at
>>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> at
>>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> at
>>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> at
>>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> at
>>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> at
>>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> at
>>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> at
>>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>> at
>>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>> at
>>
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>> at java.lang.Thread.run(Thread.java:636)
>> Caused by: org.hibernate.TransactionException: JDBC begin failed:
>> at
>>
>> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
>> at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>> at
>>
>> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
>> ... 36 more
>> Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>> Communications link failure
>>
>> Last packet sent to the server was 0 ms ago.
>> at
>> sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown
>> Source)
>> at
>>
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> at
>> java.lang.reflect.Constructor.newInstance(Constructor.java:532)
>> at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
>> at
>>
>> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
>> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
>> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
>> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
>> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
>> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
>> at
>> com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
>> at
>> com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
>> at
>>
>> com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
>> at
>>
>> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
>> ... 38 more
>> Caused by: java.io.EOFException: Can not read response from server.
>> Expected
>> to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
>> at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
>> at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
>> ... 46 more
>>
>> =========================================================
>>
>> And without any action it starts to work by itself.
>>
>> MySQL is fine. I have checked it with dhis user and in fact there is a
>> dhis
>> user connected:
>>
>> =========================================================
>> [root@DhisServer tomcat6]# mysql -u dhis -p
>>
>> Welcome to the MySQL monitor. Commands end with ; or \g.
>> Your MySQL connection id is 1346
>> Server version: 5.1.30-log MySQL Community Server (GPL)
>>
>> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>>
>> > status
>> --------------
>> mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64) using
>> readline 5.1
>>
>> Connection id: 1346
>> Current database:
>> Current user: dhis@localhost
>> SSL: Not in use
>> Current pager: stdout
>> Using outfile: ''
>> Using delimiter: ;
>> Server version: 5.1.30-log MySQL Community Server (GPL)
>> Protocol version: 10
>> Connection: Localhost via UNIX socket
>> Server characterset: utf8
>> Db characterset: utf8
>> Client characterset: latin1
>> Conn. characterset: latin1
>> UNIX socket: /var/lib/mysql/mysql.sock
>> Uptime: 10 days 18 hours 4 min 44 sec
>>
>> Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush
>> tables:
>> 1 Open tables: 511 Queries per second avg: 0.152
>> --------------
>>
>> > show processlist;
>>
>> +------+------+-----------------+---------+---------+------+-------+------------------+
>> > Id | User | Host | db | Command | Time | State |
>> Info |
>>
>> +------+------+-----------------+---------+---------+------+-------+------------------+
>> > 1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |
>> NULL |
>> > 1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |
>> NULL |
>> > 1346 | dhis | localhost | NULL | Query | 0 | NULL |
>> show
>> processlist |
>>
>> +------+------+-----------------+---------+---------+------+-------+------------------+
>> 3 rows in set (0.00 sec)
>>
>> ===================================================
>>
>>
>> I am using the last stable DHIS war file (2.0.4).
>> My JAVA_OPTS="-Xms128m -Xmx700m -XX:MaxPermSize=256m"
>>
>> I am on Fedora Linux: Fedora release 10 (Cambridge)
>> And Tomcat 6.0.18.
>>
>> Can you help me guys?
>>
>> Caveman
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>
>
>
> --
> --
> Jason P. Pickering
> email: jason.p.pickering@gmail.com
> tel:+260968395190
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>

Thanks for these very clarifying answers. I have googled and actually there are lot of people with this.

And one of the suggestions to cope, it was exactly the 127.0.0.1 thing. Yes I had two versions of JDBC driver for MySQL, one inside de java_home and another on lib of DHIS2. I removed this one. And now I am waiting for the famous error.

Caveman

···

On Wed, Jun 23, 2010 at 7:29 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

On 23 June 2010 18:00, Orvalho Augusto orvaquim@gmail.com wrote:

Sorry for my laziness on this.

My hibernate.properties

hibernate.dialect = org.hibernate.dialect.MySQLDialect

hibernate.connection.driver_class = com.mysql.jdbc.Driver

##hibernate.connection.url =

jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.url =

jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.username = dhis

hibernate.connection.password = dhis

hibernate.hbm2ddl.auto = update

By this you are right. I am using unix socket when setting with localhost on

URL. I must write 127.0.0.1.

I have changed and I am waiting to see it again.

The unix domain socket is a bit of a distraction as java does not

support unix domain sockets so the hibernate connection will always be

tcp anyway. So waiting will not help :slight_smile:

This happened not only with importing and etc… it happened on the login

too.

I have seen reports of certain mixtures of jdbc drivers and versions

causing problems. You might want to check that against other

experiences on google.

Regards

Bob

Thank you

Caveman

On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe bobjolliffe@gmail.com wrote:

I can see from the status message that unix domain sockets are being

used by the mysql client. Your hibernate connection will use tcp/ip.

The problem seems definitely to be with the transport layer -

"Expected to read 4 bytes, read 0 bytes before connection was

unexpectedly lost". So the socket channel definitely goes bad on you

:frowning:

Orvalho is this problem completely random or can you think is there

any pattern to it? For example I have seen a problem with mysql if

you are doing a very large import and the size of the mysql packet

(with all the multiple inserts) exceeds a hard limit - there is a

setting to increase this. But from what you are saying (from time to

time) I don’t think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards

Bob

On 23 June 2010 07:09, Jason Pickering jason.p.pickering@gmail.com > > >> wrote:

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?

Regards,

Jason

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto orvaquim@gmail.com > > >> > wrote:

From time to time my DHIS stalls and report me this:

=========================================================

Jun 23, 2010 5:15:53 AM org.apache.catalina.core.StandardWrapperValve

invoke

SEVERE: Servlet.service() for servlet default threw exception

org.springframework.transaction.CannotCreateTransactionException: Could

not

open Hibernate Session for transaction; nested exception is

org.hibernate.TransactionException: JDBC beg

in failed:

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

    at

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

    at

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

    at

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

    at

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

    at

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

    at $Proxy72.loadUserByUsername(Unknown Source)
    at

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

    at

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

    at

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

    at

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

    at

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

    at

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

    at

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

    at

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

    at

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

    at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    at

org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:636)

Caused by: org.hibernate.TransactionException: JDBC begin failed:

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

    at

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

    ... 36 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

Communications link failure

Last packet sent to the server was 0 ms ago.

    at

sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown

Source)

    at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at

java.lang.reflect.Constructor.newInstance(Constructor.java:532)

    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at

com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

    at

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

    at

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

    ... 38 more

Caused by: java.io.EOFException: Can not read response from server.

Expected

to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
    ... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is a

dhis

user connected:

=========================================================

[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1346

Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

status


mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64) using

readline 5.1

Connection id: 1346

Current database:

Current user: dhis@localhost

SSL: Not in use

Current pager: stdout

Using outfile: ‘’

Using delimiter: ;

Server version: 5.1.30-log MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db characterset: utf8

Client characterset: latin1

Conn. characterset: latin1

UNIX socket: /var/lib/mysql/mysql.sock

Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush

tables:

1 Open tables: 511 Queries per second avg: 0.152


show processlist;

±-----±-----±----------------±--------±--------±-----±------±-----------------+

Id | User | Host | db | Command | Time | State |

Info |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |

NULL |

1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |

NULL |

1346 | dhis | localhost | NULL | Query | 0 | NULL |

show

processlist |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).

My JAVA_OPTS=“-Xms128m -Xmx700m -XX:MaxPermSize=256m”

I am on Fedora Linux: Fedora release 10 (Cambridge)

And Tomcat 6.0.18.

Can you help me guys?

Caveman


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+260968395190


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Thanks for these very clarifying answers. I have googled and actually there
are lot of people with this.

And one of the suggestions to cope, it was exactly the 127.0.0.1 thing.

Don't believe everything you read on google :slight_smile: The simple fact is
that a jdbc connection will always use tcp and never use unix domain
sockets. So I think the locahost vs 127.0.0.1 thing is probably
another red herring.

Yes
I had two versions of JDBC driver for MySQL, one inside de java_home and
another on lib of DHIS2. I removed this one. And now I am waiting for the
famous error.

Now that sounds more interesting. Please let us know how the
consequences of this turn out.

Regards
Bob

···

On 24 June 2010 13:53, Orvalho Augusto <orvaquim@gmail.com> wrote:

Caveman

On Wed, Jun 23, 2010 at 7:29 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

On 23 June 2010 18:00, Orvalho Augusto <orvaquim@gmail.com> wrote:
> Sorry for my laziness on this.
>
> My hibernate.properties
>
> hibernate.dialect = org.hibernate.dialect.MySQLDialect
> hibernate.connection.driver_class = com.mysql.jdbc.Driver
> ##hibernate.connection.url =
> jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8
> hibernate.connection.url =
> jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8
> hibernate.connection.username = dhis
> hibernate.connection.password = dhis
> hibernate.hbm2ddl.auto = update
>
> By this you are right. I am using unix socket when setting with
> localhost on
> URL. I must write 127.0.0.1.
>
> I have changed and I am waiting to see it again.

The unix domain socket is a bit of a distraction as java does not
support unix domain sockets so the hibernate connection will always be
tcp anyway. So waiting will not help :slight_smile:

>
> This happened not only with importing and etc... it happened on the
> login
> too.

I have seen reports of certain mixtures of jdbc drivers and versions
causing problems. You might want to check that against other
experiences on google.

Regards
Bob

>
> Thank you
> Caveman
>
>
> On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe <bobjolliffe@gmail.com> >> > wrote:
>>
>> I can see from the status message that unix domain sockets are being
>> used by the mysql client. Your hibernate connection will use tcp/ip.
>>
>> The problem seems definitely to be with the transport layer -
>> "Expected to read 4 bytes, read 0 bytes before connection was
>> unexpectedly lost". So the socket channel definitely goes bad on you
>> :frowning:
>>
>> Orvalho is this problem completely random or can you think is there
>> any pattern to it? For example I have seen a problem with mysql if
>> you are doing a very large import and the size of the mysql packet
>> (with all the multiple inserts) exceeds a hard limit - there is a
>> setting to increase this. But from what you are saying (from time to
>> time) I don't think this is the case here.
>>
>> Is the mysql server on the same machine as the dhis web server?
>>
>> What is the server os and version?
>>
>> Regards
>> Bob
>>
>> On 23 June 2010 07:09, Jason Pickering <jason.p.pickering@gmail.com> >> >> wrote:
>> > Can you send your hibernate.properties file (otherwise privately)?
>> >
>> > Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?
>> >
>> > Regards,
>> > Jason
>> >
>> >
>> > On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto <orvaquim@gmail.com> >> >> > wrote:
>> >> >From time to time my DHIS stalls and report me this:
>> >> =========================================================
>> >> Jun 23, 2010 5:15:53 AM
>> >> org.apache.catalina.core.StandardWrapperValve
>> >> invoke
>> >> SEVERE: Servlet.service() for servlet default threw exception
>> >> org.springframework.transaction.CannotCreateTransactionException:
>> >> Could
>> >> not
>> >> open Hibernate Session for transaction; nested exception is
>> >> org.hibernate.TransactionException: JDBC beg
>> >> in failed:
>> >> at
>> >>
>> >>
>> >> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
>> >> at
>> >>
>> >>
>> >> org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
>> >> at
>> >>
>> >>
>> >> org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
>> >> at
>> >>
>> >>
>> >> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
>> >> at
>> >>
>> >>
>> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >> at
>> >>
>> >>
>> >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> >> at $Proxy72.loadUserByUsername(Unknown Source)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
>> >> at
>> >>
>> >>
>> >> org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
>> >> at
>> >>
>> >>
>> >> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
>> >> at
>> >>
>> >>
>> >> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >> at
>> >>
>> >>
>> >> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> >> at
>> >>
>> >>
>> >> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> >> at
>> >>
>> >>
>> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>> >> at
>> >>
>> >>
>> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>> >> at
>> >>
>> >>
>> >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> >> at
>> >>
>> >> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>> >> at java.lang.Thread.run(Thread.java:636)
>> >> Caused by: org.hibernate.TransactionException: JDBC begin failed:
>> >> at
>> >>
>> >>
>> >> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
>> >> at
>> >>
>> >> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>> >> at
>> >>
>> >>
>> >> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
>> >> ... 36 more
>> >> Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>> >> Communications link failure
>> >>
>> >> Last packet sent to the server was 0 ms ago.
>> >> at
>> >> sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown
>> >> Source)
>> >> at
>> >>
>> >>
>> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> >> at
>> >> java.lang.reflect.Constructor.newInstance(Constructor.java:532)
>> >> at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
>> >> at
>> >>
>> >>
>> >> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
>> >> at
>> >> com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
>> >> at
>> >> com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
>> >> at
>> >> com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
>> >> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
>> >> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
>> >> at
>> >> com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
>> >> at
>> >>
>> >> com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
>> >> at
>> >>
>> >>
>> >> com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
>> >> at
>> >>
>> >>
>> >> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
>> >> ... 38 more
>> >> Caused by: java.io.EOFException: Can not read response from server.
>> >> Expected
>> >> to read 4 bytes, read 0 bytes before connection was unexpectedly
>> >> lost.
>> >> at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
>> >> at
>> >> com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
>> >> ... 46 more
>> >>
>> >> =========================================================
>> >>
>> >> And without any action it starts to work by itself.
>> >>
>> >> MySQL is fine. I have checked it with dhis user and in fact there is
>> >> a
>> >> dhis
>> >> user connected:
>> >>
>> >> =========================================================
>> >> [root@DhisServer tomcat6]# mysql -u dhis -p
>> >>
>> >> Welcome to the MySQL monitor. Commands end with ; or \g.
>> >> Your MySQL connection id is 1346
>> >> Server version: 5.1.30-log MySQL Community Server (GPL)
>> >>
>> >> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>> >>
>> >> > status
>> >> --------------
>> >> mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64)
>> >> using
>> >> readline 5.1
>> >>
>> >> Connection id: 1346
>> >> Current database:
>> >> Current user: dhis@localhost
>> >> SSL: Not in use
>> >> Current pager: stdout
>> >> Using outfile: ''
>> >> Using delimiter: ;
>> >> Server version: 5.1.30-log MySQL Community Server (GPL)
>> >> Protocol version: 10
>> >> Connection: Localhost via UNIX socket
>> >> Server characterset: utf8
>> >> Db characterset: utf8
>> >> Client characterset: latin1
>> >> Conn. characterset: latin1
>> >> UNIX socket: /var/lib/mysql/mysql.sock
>> >> Uptime: 10 days 18 hours 4 min 44 sec
>> >>
>> >> Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush
>> >> tables:
>> >> 1 Open tables: 511 Queries per second avg: 0.152
>> >> --------------
>> >>
>> >> > show processlist;
>> >>
>> >>
>> >> +------+------+-----------------+---------+---------+------+-------+------------------+
>> >> > Id | User | Host | db | Command | Time | State |
>> >> Info |
>> >>
>> >>
>> >> +------+------+-----------------+---------+---------+------+-------+------------------+
>> >> > 1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |
>> >> NULL |
>> >> > 1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |
>> >> NULL |
>> >> > 1346 | dhis | localhost | NULL | Query | 0 | NULL |
>> >> show
>> >> processlist |
>> >>
>> >>
>> >> +------+------+-----------------+---------+---------+------+-------+------------------+
>> >> 3 rows in set (0.00 sec)
>> >>
>> >> ===================================================
>> >>
>> >>
>> >> I am using the last stable DHIS war file (2.0.4).
>> >> My JAVA_OPTS="-Xms128m -Xmx700m -XX:MaxPermSize=256m"
>> >>
>> >> I am on Fedora Linux: Fedora release 10 (Cambridge)
>> >> And Tomcat 6.0.18.
>> >>
>> >> Can you help me guys?
>> >>
>> >> Caveman
>> >>
>> >>
>> >> _______________________________________________
>> >> Mailing list: https://launchpad.net/~dhis2-devs
>> >> Post to : dhis2-devs@lists.launchpad.net
>> >> Unsubscribe : https://launchpad.net/~dhis2-devs
>> >> More help : https://help.launchpad.net/ListHelp
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > --
>> > Jason P. Pickering
>> > email: jason.p.pickering@gmail.com
>> > tel:+260968395190
>> >
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~dhis2-devs
>> > Post to : dhis2-devs@lists.launchpad.net
>> > Unsubscribe : https://launchpad.net/~dhis2-devs
>> > More help : https://help.launchpad.net/ListHelp
>> >
>
>
>

I have waited and now I have got this:

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed:

	org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
	org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

	org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	$Proxy72.loadUserByUsername(Unknown Source)

	org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
	org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

	org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
	org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
	org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

org.hibernate.TransactionException: JDBC begin failed:
	org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
	org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

	org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
	org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

	org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	$Proxy72.loadUserByUsername(Unknown Source)

	org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
	org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

	org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
	org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
	org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was229878 seconds ago.The last packet sent successfully to the server was 229878 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

	java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246)

	com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)
	com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
	com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
	com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

	com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
	org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
	org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

	org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
	org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

	org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	$Proxy72.loadUserByUsername(Unknown Source)

	org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
	org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

	org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
	org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
	org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

java.net.SocketException: Broken pipe
	java.net.SocketOutputStream.socketWrite0(Native Method)
	java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
	java.net.SocketOutputStream.write(SocketOutputStream.java:153)

	java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
	com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227)
	com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)

	com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
	com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
	com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
	com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

	org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
	org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
	org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

	org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
	org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	$Proxy72.loadUserByUsername(Unknown Source)
	org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

	org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
	org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

	org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
	org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

I will place the autoReconnect=true on the URL. I must confess I have another DHIS running without these troubles and I am using openJDK (java from Sun/Oracle) on both.

Thanks
Caveman

···

On Thu, Jun 24, 2010 at 3:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

On 24 June 2010 13:53, Orvalho Augusto orvaquim@gmail.com wrote:

Thanks for these very clarifying answers. I have googled and actually there

are lot of people with this.

And one of the suggestions to cope, it was exactly the 127.0.0.1 thing.

Don’t believe everything you read on google :slight_smile: The simple fact is

that a jdbc connection will always use tcp and never use unix domain

sockets. So I think the locahost vs 127.0.0.1 thing is probably

another red herring.

Yes

I had two versions of JDBC driver for MySQL, one inside de java_home and

another on lib of DHIS2. I removed this one. And now I am waiting for the

famous error.

Now that sounds more interesting. Please let us know how the

consequences of this turn out.

Regards

Bob

Caveman

On Wed, Jun 23, 2010 at 7:29 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

On 23 June 2010 18:00, Orvalho Augusto orvaquim@gmail.com wrote:

Sorry for my laziness on this.

My hibernate.properties

hibernate.dialect = org.hibernate.dialect.MySQLDialect

hibernate.connection.driver_class = com.mysql.jdbc.Driver

##hibernate.connection.url =

jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.url =

jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.username = dhis

hibernate.connection.password = dhis

hibernate.hbm2ddl.auto = update

By this you are right. I am using unix socket when setting with

localhost on

URL. I must write 127.0.0.1.

I have changed and I am waiting to see it again.

The unix domain socket is a bit of a distraction as java does not

support unix domain sockets so the hibernate connection will always be

tcp anyway. So waiting will not help :slight_smile:

This happened not only with importing and etc… it happened on the

login

too.

I have seen reports of certain mixtures of jdbc drivers and versions

causing problems. You might want to check that against other

experiences on google.

Regards

Bob

Thank you

Caveman

On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe bobjolliffe@gmail.com > > >> > wrote:

I can see from the status message that unix domain sockets are being

used by the mysql client. Your hibernate connection will use tcp/ip.

The problem seems definitely to be with the transport layer -

"Expected to read 4 bytes, read 0 bytes before connection was

unexpectedly lost". So the socket channel definitely goes bad on you

:frowning:

Orvalho is this problem completely random or can you think is there

any pattern to it? For example I have seen a problem with mysql if

you are doing a very large import and the size of the mysql packet

(with all the multiple inserts) exceeds a hard limit - there is a

setting to increase this. But from what you are saying (from time to

time) I don’t think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards

Bob

On 23 June 2010 07:09, Jason Pickering jason.p.pickering@gmail.com > > >> >> wrote:

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?

Regards,

Jason

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto orvaquim@gmail.com > > >> >> > wrote:

From time to time my DHIS stalls and report me this:

=========================================================

Jun 23, 2010 5:15:53 AM

org.apache.catalina.core.StandardWrapperValve

invoke

SEVERE: Servlet.service() for servlet default threw exception

org.springframework.transaction.CannotCreateTransactionException:

Could

not

open Hibernate Session for transaction; nested exception is

org.hibernate.TransactionException: JDBC beg

in failed:

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

    at

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

    at

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

    at

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

    at

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

    at

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

    at $Proxy72.loadUserByUsername(Unknown Source)
    at

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

    at

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

    at

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

    at

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

    at

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

    at

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

    at

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

    at

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

    at

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

    at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    at

org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:636)

Caused by: org.hibernate.TransactionException: JDBC begin failed:

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

    at

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

    ... 36 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

Communications link failure

Last packet sent to the server was 0 ms ago.

    at

sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown

Source)

    at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at

java.lang.reflect.Constructor.newInstance(Constructor.java:532)

    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at

com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)

    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)

    at

com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)

    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

    at

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

    at

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

    ... 38 more

Caused by: java.io.EOFException: Can not read response from server.

Expected

to read 4 bytes, read 0 bytes before connection was unexpectedly

lost.

    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)

    ... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is

a

dhis

user connected:

=========================================================

[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1346

Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

status


mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64)

using

readline 5.1

Connection id: 1346

Current database:

Current user: dhis@localhost

SSL: Not in use

Current pager: stdout

Using outfile: ‘’

Using delimiter: ;

Server version: 5.1.30-log MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db characterset: utf8

Client characterset: latin1

Conn. characterset: latin1

UNIX socket: /var/lib/mysql/mysql.sock

Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush

tables:

1 Open tables: 511 Queries per second avg: 0.152


show processlist;

±-----±-----±----------------±--------±--------±-----±------±-----------------+

Id | User | Host | db | Command | Time | State |

Info |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |

NULL |

1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |

NULL |

1346 | dhis | localhost | NULL | Query | 0 | NULL |

show

processlist |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).

My JAVA_OPTS=“-Xms128m -Xmx700m -XX:MaxPermSize=256m”

I am on Fedora Linux: Fedora release 10 (Cambridge)

And Tomcat 6.0.18.

Can you help me guys?

Caveman


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+260968395190


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

A long shot, but could this be the mysql wait_timeout problem?

Ola

···

On 28 June 2010 05:32, Orvalho Augusto orvaquim@gmail.com wrote:

I have waited and now I have got this:

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed:

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

$Proxy72.loadUserByUsername(Unknown Source)

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

org.hibernate.TransactionException: JDBC begin failed:

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

$Proxy72.loadUserByUsername(Unknown Source)

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was229878 seconds ago.The last packet sent successfully to the server was 229878 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.


	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

java.lang.reflect.Constructor.newInstance(Constructor.java:532)

com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246)

com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)

com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

$Proxy72.loadUserByUsername(Unknown Source)

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

java.net.SocketException: Broken pipe
	java.net.SocketOutputStream.socketWrite0(Native Method)
	java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
	java.net.SocketOutputStream.write(SocketOutputStream.java:153)


	java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
	com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227)
	com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)


	com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

$Proxy72.loadUserByUsername(Unknown Source)

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

I will place the autoReconnect=true on the URL. I must confess I have another DHIS running without these troubles and I am using openJDK (java from Sun/Oracle) on both.

Thanks
Caveman

On Thu, Jun 24, 2010 at 3:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

On 24 June 2010 13:53, Orvalho Augusto orvaquim@gmail.com wrote:

Thanks for these very clarifying answers. I have googled and actually there

are lot of people with this.

And one of the suggestions to cope, it was exactly the 127.0.0.1 thing.

Don’t believe everything you read on google :slight_smile: The simple fact is

that a jdbc connection will always use tcp and never use unix domain

sockets. So I think the locahost vs 127.0.0.1 thing is probably

another red herring.

Yes

I had two versions of JDBC driver for MySQL, one inside de java_home and

another on lib of DHIS2. I removed this one. And now I am waiting for the

famous error.

Now that sounds more interesting. Please let us know how the

consequences of this turn out.

Regards

Bob

Caveman

On Wed, Jun 23, 2010 at 7:29 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

On 23 June 2010 18:00, Orvalho Augusto orvaquim@gmail.com wrote:

Sorry for my laziness on this.

My hibernate.properties

hibernate.dialect = org.hibernate.dialect.MySQLDialect

hibernate.connection.driver_class = com.mysql.jdbc.Driver

##hibernate.connection.url =

jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.url =

jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.username = dhis

hibernate.connection.password = dhis

hibernate.hbm2ddl.auto = update

By this you are right. I am using unix socket when setting with

localhost on

URL. I must write 127.0.0.1.

I have changed and I am waiting to see it again.

The unix domain socket is a bit of a distraction as java does not

support unix domain sockets so the hibernate connection will always be

tcp anyway. So waiting will not help :slight_smile:

This happened not only with importing and etc… it happened on the

login

too.

I have seen reports of certain mixtures of jdbc drivers and versions

causing problems. You might want to check that against other

experiences on google.

Regards

Bob

Thank you

Caveman

On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe bobjolliffe@gmail.com > > > > >> > wrote:

I can see from the status message that unix domain sockets are being

used by the mysql client. Your hibernate connection will use tcp/ip.

The problem seems definitely to be with the transport layer -

"Expected to read 4 bytes, read 0 bytes before connection was

unexpectedly lost". So the socket channel definitely goes bad on you

:frowning:

Orvalho is this problem completely random or can you think is there

any pattern to it? For example I have seen a problem with mysql if

you are doing a very large import and the size of the mysql packet

(with all the multiple inserts) exceeds a hard limit - there is a

setting to increase this. But from what you are saying (from time to

time) I don’t think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards

Bob

On 23 June 2010 07:09, Jason Pickering jason.p.pickering@gmail.com > > > > >> >> wrote:

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix pipes)?

Regards,

Jason

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto orvaquim@gmail.com > > > > >> >> > wrote:

From time to time my DHIS stalls and report me this:

=========================================================

Jun 23, 2010 5:15:53 AM

org.apache.catalina.core.StandardWrapperValve

invoke

SEVERE: Servlet.service() for servlet default threw exception

org.springframework.transaction.CannotCreateTransactionException:

Could

not

open Hibernate Session for transaction; nested exception is

org.hibernate.TransactionException: JDBC beg

in failed:

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

    at

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

    at

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

    at

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

    at

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

    at

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

    at $Proxy72.loadUserByUsername(Unknown Source)
    at

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

    at

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

    at

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

    at

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

    at

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

    at

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

    at

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

    at

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

    at

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

    at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    at

org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:636)

Caused by: org.hibernate.TransactionException: JDBC begin failed:

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

    at

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

    ... 36 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

Communications link failure

Last packet sent to the server was 0 ms ago.

    at

sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown

Source)

    at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at

java.lang.reflect.Constructor.newInstance(Constructor.java:532)

    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at

com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)

    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)

    at

com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)

    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

    at

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

    at

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

    ... 38 more

Caused by: java.io.EOFException: Can not read response from server.

Expected

to read 4 bytes, read 0 bytes before connection was unexpectedly

lost.

    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)

    ... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there is

a

dhis

user connected:

=========================================================

[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1346

Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

status


mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64)

using

readline 5.1

Connection id: 1346

Current database:

Current user: dhis@localhost

SSL: Not in use

Current pager: stdout

Using outfile: ‘’

Using delimiter: ;

Server version: 5.1.30-log MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db characterset: utf8

Client characterset: latin1

Conn. characterset: latin1

UNIX socket: /var/lib/mysql/mysql.sock

Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220 Flush

tables:

1 Open tables: 511 Queries per second avg: 0.152


show processlist;

±-----±-----±----------------±--------±--------±-----±------±-----------------+

Id | User | Host | db | Command | Time | State |

Info |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

1341 | dhis | localhost:58090 | dhis204 | Sleep | 540 | |

NULL |

1342 | dhis | localhost:41792 | dhis204 | Sleep | 540 | |

NULL |

1346 | dhis | localhost | NULL | Query | 0 | NULL |

show

processlist |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).

My JAVA_OPTS=“-Xms128m -Xmx700m -XX:MaxPermSize=256m”

I am on Fedora Linux: Fedora release 10 (Cambridge)

And Tomcat 6.0.18.

Can you help me guys?

Caveman


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+260968395190


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi

It looks like the driver is handing out a connection to be used from
the pool which is broken ie the socket is no longer in a connected
state.

Hopefully autoReconnect=true might fix it.

If not I would take a look at tuning c3po pool parameters. There are
parameters like idleTestperiod for example, which can be set to
periodically check all your pooled but idle connections.

Regards
Bob

···

On 28 June 2010 04:32, Orvalho Augusto <orvaquim@gmail.com> wrote:

I have waited and now I have got this:

org.springframework.transaction.CannotCreateTransactionException: Could not
open Hibernate Session for transaction; nested exception is
org.hibernate.TransactionException: JDBC begin failed:

  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)

  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

org.hibernate.TransactionException: JDBC begin failed:
  org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
  org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)

  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet
successfully received from the server was229878 seconds ago.The last packet
sent successfully to the server was 229878 seconds ago, which is longer
than the server configured value of 'wait_timeout'. You should consider
either expiring and/or testing connection validity before use in your
application, increasing the server configured values for client timeouts, or
using the Connector/J connection property 'autoReconnect=true' to avoid this
problem.

  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

  java.lang.reflect.Constructor.newInstance(Constructor.java:532)
  com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
  com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
  com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246)

  com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)
  com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
  com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
  com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

  com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
  org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
  org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)

  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

java.net.SocketException: Broken pipe
  java.net.SocketOutputStream.socketWrite0(Native Method)
  java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
  java.net.SocketOutputStream.write(SocketOutputStream.java:153)

  java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
  java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
  com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227)
  com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)

  com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
  com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
  com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
  com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

  org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
  org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)
  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

I will place the autoReconnect=true on the URL. I must confess I have
another DHIS running without these troubles and I am using openJDK (java
from Sun/Oracle) on both.

Thanks
Caveman

On Thu, Jun 24, 2010 at 3:48 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

On 24 June 2010 13:53, Orvalho Augusto <orvaquim@gmail.com> wrote:
> Thanks for these very clarifying answers. I have googled and actually
> there
> are lot of people with this.
>
> And one of the suggestions to cope, it was exactly the 127.0.0.1 thing.

Don't believe everything you read on google :slight_smile: The simple fact is
that a jdbc connection will always use tcp and never use unix domain
sockets. So I think the locahost vs 127.0.0.1 thing is probably
another red herring.

>Yes
> I had two versions of JDBC driver for MySQL, one inside de java_home and
> another on lib of DHIS2. I removed this one. And now I am waiting for
> the
> famous error.

Now that sounds more interesting. Please let us know how the
consequences of this turn out.

Regards
Bob

>
> Caveman
>
>
> On Wed, Jun 23, 2010 at 7:29 PM, Bob Jolliffe <bobjolliffe@gmail.com> >> > wrote:
>>
>> On 23 June 2010 18:00, Orvalho Augusto <orvaquim@gmail.com> wrote:
>> > Sorry for my laziness on this.
>> >
>> > My hibernate.properties
>> >
>> > hibernate.dialect = org.hibernate.dialect.MySQLDialect
>> > hibernate.connection.driver_class = com.mysql.jdbc.Driver
>> > ##hibernate.connection.url =
>> >
>> > jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8
>> > hibernate.connection.url =
>> >
>> > jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8
>> > hibernate.connection.username = dhis
>> > hibernate.connection.password = dhis
>> > hibernate.hbm2ddl.auto = update
>> >
>> > By this you are right. I am using unix socket when setting with
>> > localhost on
>> > URL. I must write 127.0.0.1.
>> >
>> > I have changed and I am waiting to see it again.
>>
>> The unix domain socket is a bit of a distraction as java does not
>> support unix domain sockets so the hibernate connection will always be
>> tcp anyway. So waiting will not help :slight_smile:
>>
>> >
>> > This happened not only with importing and etc... it happened on the
>> > login
>> > too.
>>
>> I have seen reports of certain mixtures of jdbc drivers and versions
>> causing problems. You might want to check that against other
>> experiences on google.
>>
>> Regards
>> Bob
>>
>> >
>> > Thank you
>> > Caveman
>> >
>> >
>> > On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe <bobjolliffe@gmail.com> >> >> > wrote:
>> >>
>> >> I can see from the status message that unix domain sockets are being
>> >> used by the mysql client. Your hibernate connection will use
>> >> tcp/ip.
>> >>
>> >> The problem seems definitely to be with the transport layer -
>> >> "Expected to read 4 bytes, read 0 bytes before connection was
>> >> unexpectedly lost". So the socket channel definitely goes bad on
>> >> you
>> >> :frowning:
>> >>
>> >> Orvalho is this problem completely random or can you think is there
>> >> any pattern to it? For example I have seen a problem with mysql if
>> >> you are doing a very large import and the size of the mysql packet
>> >> (with all the multiple inserts) exceeds a hard limit - there is a
>> >> setting to increase this. But from what you are saying (from time
>> >> to
>> >> time) I don't think this is the case here.
>> >>
>> >> Is the mysql server on the same machine as the dhis web server?
>> >>
>> >> What is the server os and version?
>> >>
>> >> Regards
>> >> Bob
>> >>
>> >> On 23 June 2010 07:09, Jason Pickering <jason.p.pickering@gmail.com> >> >> >> wrote:
>> >> > Can you send your hibernate.properties file (otherwise privately)?
>> >> >
>> >> > Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix
>> >> > pipes)?
>> >> >
>> >> > Regards,
>> >> > Jason
>> >> >
>> >> >
>> >> > On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto >> >> >> > <orvaquim@gmail.com> >> >> >> > wrote:
>> >> >> >From time to time my DHIS stalls and report me this:
>> >> >> =========================================================
>> >> >> Jun 23, 2010 5:15:53 AM
>> >> >> org.apache.catalina.core.StandardWrapperValve
>> >> >> invoke
>> >> >> SEVERE: Servlet.service() for servlet default threw exception
>> >> >> org.springframework.transaction.CannotCreateTransactionException:
>> >> >> Could
>> >> >> not
>> >> >> open Hibernate Session for transaction; nested exception is
>> >> >> org.hibernate.TransactionException: JDBC beg
>> >> >> in failed:
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>> >> >> at $Proxy72.loadUserByUsername(Unknown Source)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> >> >> at
>> >> >>
>> >> >>
>> >> >> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>> >> >> at java.lang.Thread.run(Thread.java:636)
>> >> >> Caused by: org.hibernate.TransactionException: JDBC begin failed:
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
>> >> >> at
>> >> >>
>> >> >>
>> >> >> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
>> >> >> ... 36 more
>> >> >> Caused by:
>> >> >> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>> >> >> Communications link failure
>> >> >>
>> >> >> Last packet sent to the server was 0 ms ago.
>> >> >> at
>> >> >> sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown
>> >> >> Source)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> >> >> at
>> >> >> java.lang.reflect.Constructor.newInstance(Constructor.java:532)
>> >> >> at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
>> >> >> at
>> >> >> com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)
>> >> >> at
>> >> >> com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)
>> >> >> at
>> >> >> com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)
>> >> >> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
>> >> >> at
>> >> >> com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
>> >> >> at
>> >> >> com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
>> >> >> at
>> >> >>
>> >> >>
>> >> >> com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
>> >> >> at
>> >> >>
>> >> >>
>> >> >>
>> >> >> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
>> >> >> ... 38 more
>> >> >> Caused by: java.io.EOFException: Can not read response from
>> >> >> server.
>> >> >> Expected
>> >> >> to read 4 bytes, read 0 bytes before connection was unexpectedly
>> >> >> lost.
>> >> >> at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
>> >> >> at
>> >> >> com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)
>> >> >> ... 46 more
>> >> >>
>> >> >> =========================================================
>> >> >>
>> >> >> And without any action it starts to work by itself.
>> >> >>
>> >> >> MySQL is fine. I have checked it with dhis user and in fact there
>> >> >> is
>> >> >> a
>> >> >> dhis
>> >> >> user connected:
>> >> >>
>> >> >> =========================================================
>> >> >> [root@DhisServer tomcat6]# mysql -u dhis -p
>> >> >>
>> >> >> Welcome to the MySQL monitor. Commands end with ; or \g.
>> >> >> Your MySQL connection id is 1346
>> >> >> Server version: 5.1.30-log MySQL Community Server (GPL)
>> >> >>
>> >> >> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>> >> >>
>> >> >> > status
>> >> >> --------------
>> >> >> mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64)
>> >> >> using
>> >> >> readline 5.1
>> >> >>
>> >> >> Connection id: 1346
>> >> >> Current database:
>> >> >> Current user: dhis@localhost
>> >> >> SSL: Not in use
>> >> >> Current pager: stdout
>> >> >> Using outfile: ''
>> >> >> Using delimiter: ;
>> >> >> Server version: 5.1.30-log MySQL Community Server (GPL)
>> >> >> Protocol version: 10
>> >> >> Connection: Localhost via UNIX socket
>> >> >> Server characterset: utf8
>> >> >> Db characterset: utf8
>> >> >> Client characterset: latin1
>> >> >> Conn. characterset: latin1
>> >> >> UNIX socket: /var/lib/mysql/mysql.sock
>> >> >> Uptime: 10 days 18 hours 4 min 44 sec
>> >> >>
>> >> >> Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220
>> >> >> Flush
>> >> >> tables:
>> >> >> 1 Open tables: 511 Queries per second avg: 0.152
>> >> >> --------------
>> >> >>
>> >> >> > show processlist;
>> >> >>
>> >> >>
>> >> >>
>> >> >> +------+------+-----------------+---------+---------+------+-------+------------------+
>> >> >> > Id | User | Host | db | Command | Time |
>> >> >> State |
>> >> >> Info |
>> >> >>
>> >> >>
>> >> >>
>> >> >> +------+------+-----------------+---------+---------+------+-------+------------------+
>> >> >> > 1341 | dhis | localhost:58090 | dhis204 | Sleep | 540
>> >> >> > >
>> >> >> NULL |
>> >> >> > 1342 | dhis | localhost:41792 | dhis204 | Sleep | 540
>> >> >> > >
>> >> >> NULL |
>> >> >> > 1346 | dhis | localhost | NULL | Query | 0 |
>> >> >> NULL |
>> >> >> show
>> >> >> processlist |
>> >> >>
>> >> >>
>> >> >>
>> >> >> +------+------+-----------------+---------+---------+------+-------+------------------+
>> >> >> 3 rows in set (0.00 sec)
>> >> >>
>> >> >> ===================================================
>> >> >>
>> >> >>
>> >> >> I am using the last stable DHIS war file (2.0.4).
>> >> >> My JAVA_OPTS="-Xms128m -Xmx700m -XX:MaxPermSize=256m"
>> >> >>
>> >> >> I am on Fedora Linux: Fedora release 10 (Cambridge)
>> >> >> And Tomcat 6.0.18.
>> >> >>
>> >> >> Can you help me guys?
>> >> >>
>> >> >> Caveman
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> Mailing list: https://launchpad.net/~dhis2-devs
>> >> >> Post to : dhis2-devs@lists.launchpad.net
>> >> >> Unsubscribe : https://launchpad.net/~dhis2-devs
>> >> >> More help : https://help.launchpad.net/ListHelp
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > --
>> >> > Jason P. Pickering
>> >> > email: jason.p.pickering@gmail.com
>> >> > tel:+260968395190
>> >> >
>> >> > _______________________________________________
>> >> > Mailing list: https://launchpad.net/~dhis2-devs
>> >> > Post to : dhis2-devs@lists.launchpad.net
>> >> > Unsubscribe : https://launchpad.net/~dhis2-devs
>> >> > More help : https://help.launchpad.net/ListHelp
>> >> >
>> >
>> >
>> >
>
>
>
>

I do not know what to do. I have found this:
http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html

And what makes me feel really bad is:
"22.3.5.3.4: ** I have a servlet/application that works fine for a day, and then stops working overnight**

          MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the "autoReconnect" parameter"

and
"The autoReconnect facility is deprecated, and may be removed in a future release. "

So what we do?

Caveman

···

On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi

It looks like the driver is handing out a connection to be used from

the pool which is broken ie the socket is no longer in a connected

state.

Hopefully autoReconnect=true might fix it.

If not I would take a look at tuning c3po pool parameters. There are

parameters like idleTestperiod for example, which can be set to

periodically check all your pooled but idle connections.

Regards

Bob

On 28 June 2010 04:32, Orvalho Augusto orvaquim@gmail.com wrote:

I have waited and now I have got this:

org.springframework.transaction.CannotCreateTransactionException: Could not

open Hibernate Session for transaction; nested exception is

org.hibernate.TransactionException: JDBC begin failed:

  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)
  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

org.hibernate.TransactionException: JDBC begin failed:

  org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
  org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)
  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet

successfully received from the server was229878 seconds ago.The last packet

sent successfully to the server was 229878 seconds ago, which is longer

than the server configured value of ‘wait_timeout’. You should consider

either expiring and/or testing connection validity before use in your

application, increasing the server configured values for client timeouts, or

using the Connector/J connection property ‘autoReconnect=true’ to avoid this

problem.

  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  java.lang.reflect.Constructor.newInstance(Constructor.java:532)
  com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
  com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
  com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3246)
  com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)
  com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
  com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
  com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
  com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
  org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
  org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)
  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

root cause

java.net.SocketException: Broken pipe

  java.net.SocketOutputStream.socketWrite0(Native Method)
  java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
  java.net.SocketOutputStream.write(SocketOutputStream.java:153)
  java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
  java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
  com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3227)
  com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1917)
  com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
  com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
  com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)
  com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
  org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)
  org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
  org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
  org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
  $Proxy72.loadUserByUsername(Unknown Source)
  org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
  org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
  org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)
  org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
  org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)
  org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
  org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
  org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
  org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

I will place the autoReconnect=true on the URL. I must confess I have

another DHIS running without these troubles and I am using openJDK (java

from Sun/Oracle) on both.

Thanks

Caveman

On Thu, Jun 24, 2010 at 3:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

On 24 June 2010 13:53, Orvalho Augusto orvaquim@gmail.com wrote:

Thanks for these very clarifying answers. I have googled and actually

there

are lot of people with this.

And one of the suggestions to cope, it was exactly the 127.0.0.1 thing.

Don’t believe everything you read on google :slight_smile: The simple fact is

that a jdbc connection will always use tcp and never use unix domain

sockets. So I think the locahost vs 127.0.0.1 thing is probably

another red herring.

Yes

I had two versions of JDBC driver for MySQL, one inside de java_home and

another on lib of DHIS2. I removed this one. And now I am waiting for

the

famous error.

Now that sounds more interesting. Please let us know how the

consequences of this turn out.

Regards

Bob

Caveman

On Wed, Jun 23, 2010 at 7:29 PM, Bob Jolliffe bobjolliffe@gmail.com > > >> > wrote:

On 23 June 2010 18:00, Orvalho Augusto orvaquim@gmail.com wrote:

Sorry for my laziness on this.

My hibernate.properties

hibernate.dialect = org.hibernate.dialect.MySQLDialect

hibernate.connection.driver_class = com.mysql.jdbc.Driver

##hibernate.connection.url =

jdbc:mysql://localhost/dhis2_pub?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.url =

jdbc:mysql://localhost/dhis204?useUnicode=true&characterEncoding=UTF-8

hibernate.connection.username = dhis

hibernate.connection.password = dhis

hibernate.hbm2ddl.auto = update

By this you are right. I am using unix socket when setting with

localhost on

URL. I must write 127.0.0.1.

I have changed and I am waiting to see it again.

The unix domain socket is a bit of a distraction as java does not

support unix domain sockets so the hibernate connection will always be

tcp anyway. So waiting will not help :slight_smile:

This happened not only with importing and etc… it happened on the

login

too.

I have seen reports of certain mixtures of jdbc drivers and versions

causing problems. You might want to check that against other

experiences on google.

Regards

Bob

Thank you

Caveman

On Wed, Jun 23, 2010 at 9:01 AM, Bob Jolliffe bobjolliffe@gmail.com > > >> >> > wrote:

I can see from the status message that unix domain sockets are being

used by the mysql client. Your hibernate connection will use

tcp/ip.

The problem seems definitely to be with the transport layer -

"Expected to read 4 bytes, read 0 bytes before connection was

unexpectedly lost". So the socket channel definitely goes bad on

you

:frowning:

Orvalho is this problem completely random or can you think is there

any pattern to it? For example I have seen a problem with mysql if

you are doing a very large import and the size of the mysql packet

(with all the multiple inserts) exceeds a hard limit - there is a

setting to increase this. But from what you are saying (from time

to

time) I don’t think this is the case here.

Is the mysql server on the same machine as the dhis web server?

What is the server os and version?

Regards

Bob

On 23 June 2010 07:09, Jason Pickering jason.p.pickering@gmail.com > > >> >> >> wrote:

Can you send your hibernate.properties file (otherwise privately)?

Is you MySQL TCP/IP sockets available on 127.0.0.1 (not Unix

pipes)?

Regards,

Jason

On Wed, Jun 23, 2010 at 5:32 AM, Orvalho Augusto > > >> >> >> > orvaquim@gmail.com > > >> >> >> > wrote:

From time to time my DHIS stalls and report me this:

=========================================================

Jun 23, 2010 5:15:53 AM

org.apache.catalina.core.StandardWrapperValve

invoke

SEVERE: Servlet.service() for servlet default threw exception

org.springframework.transaction.CannotCreateTransactionException:

Could

not

open Hibernate Session for transaction; nested exception is

org.hibernate.TransactionException: JDBC beg

in failed:

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)

    at

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)

    at

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)

    at

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

    at

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

    at

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

    at $Proxy72.loadUserByUsername(Unknown Source)
    at

org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)

    at

org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)

    at

org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188)

    at

org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)

    at

org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82)

    at

org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:259)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)

    at

org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)

    at

org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)

    at

org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)

    at

org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)

    at

org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)

    at

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

    at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

    at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

    at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

    at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

    at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

    at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

    at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

    at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    at

org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    at java.lang.Thread.run(Thread.java:636)

Caused by: org.hibernate.TransactionException: JDBC begin failed:

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

    at

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)

    at

org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)

    ... 36 more

Caused by:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:

Communications link failure

Last packet sent to the server was 0 ms ago.

    at

sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown

Source)

    at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at

java.lang.reflect.Constructor.newInstance(Constructor.java:532)

    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at

com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2985)

    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2871)

    at

com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3414)

    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at

com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)

    at

com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)

    at

com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4874)

    at

com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)

    at

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

    ... 38 more

Caused by: java.io.EOFException: Can not read response from

server.

Expected

to read 4 bytes, read 0 bytes before connection was unexpectedly

lost.

    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2431)
    at

com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2882)

    ... 46 more

=========================================================

And without any action it starts to work by itself.

MySQL is fine. I have checked it with dhis user and in fact there

is

a

dhis

user connected:

=========================================================

[root@DhisServer tomcat6]# mysql -u dhis -p

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1346

Server version: 5.1.30-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

status


mysql Ver 14.14 Distrib 5.1.30, for unknown-linux-gnu (x86_64)

using

readline 5.1

Connection id: 1346

Current database:

Current user: dhis@localhost

SSL: Not in use

Current pager: stdout

Using outfile: ‘’

Using delimiter: ;

Server version: 5.1.30-log MySQL Community Server (GPL)

Protocol version: 10

Connection: Localhost via UNIX socket

Server characterset: utf8

Db characterset: utf8

Client characterset: latin1

Conn. characterset: latin1

UNIX socket: /var/lib/mysql/mysql.sock

Uptime: 10 days 18 hours 4 min 44 sec

Threads: 3 Questions: 141592 Slow queries: 0 Opens: 1220

Flush

tables:

1 Open tables: 511 Queries per second avg: 0.152


show processlist;

±-----±-----±----------------±--------±--------±-----±------±-----------------+

Id | User | Host | db | Command | Time |

State |

Info |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

1341 | dhis | localhost:58090 | dhis204 | Sleep | 540

  >

NULL |

1342 | dhis | localhost:41792 | dhis204 | Sleep | 540

  >

NULL |

1346 | dhis | localhost | NULL | Query | 0 |

NULL |

show

processlist |

±-----±-----±----------------±--------±--------±-----±------±-----------------+

3 rows in set (0.00 sec)

===================================================

I am using the last stable DHIS war file (2.0.4).

My JAVA_OPTS=“-Xms128m -Xmx700m -XX:MaxPermSize=256m”

I am on Fedora Linux: Fedora release 10 (Cambridge)

And Tomcat 6.0.18.

Can you help me guys?

Caveman


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+260968395190


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Is postgres out of the question?

···

On Jul 4, 2010 5:59 AM, “Orvalho Augusto” orvaquim@gmail.com wrote:

I do not know what to do. I have found this:
http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html

And what makes me feel really bad is:
"22.3.5.3.4: ** I have a servlet/application that works fine for a day, and then stops working overnight**

          MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the "autoReconnect" parameter"

and
"The autoReconnect facility is deprecated, and may be removed in a future release. "

So what we do?

Caveman

On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe bobjolliffe@gmail.com wrote: > > Hi > > It looks…


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

It will give some job because we developed a tool to convert data from one database to MySQL.

It is the only thing I can try to do to solve.

Caveman

···

On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring knutst@gmail.com wrote:

Is postgres out of the question?

On Jul 4, 2010 5:59 AM, “Orvalho Augusto” orvaquim@gmail.com wrote:

I do not know what to do. I have found this:

http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html

And what makes me feel really bad is:
"22.3.5.3.4: ** I have a servlet/application that works fine for a day, and then stops working overnight**

          MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the "autoReconnect" parameter"

and
"The autoReconnect facility is deprecated, and may be removed in a future release. "

So what we do?

Caveman

On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe bobjolliffe@gmail.com wrote: > > Hi > > It looks…


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Orvalho

Whereas I do agree postgres might solve your problems it does seem
like a drastic solution to this problem. The fact is mysql does
actually work and apparently work well so it should be possible to
solve this.

Trying to think logically here ... you have another similar setup
where everything seems ok. I suppose the load could be quite
different on the two servers, but lets discount that for a bit. If
you are reusing old stale and broken connections then the only three
places i can think to look are:
(i) the jdbc driver (version compatibility). I think you checked that.
(ii) tcp/ip problems
(iii) the connection pool

Regarding (ii) can you check the value of bind-address in
/etc/mysql/my.cnf (or whatever config file you are using). This
should be set to 127.0.0.1 unless you are connecting to the db from a
different host. At least this interface will always be up so you
shouldnt get intermittent network errors on it.

Regarding (iii) I suggest (as above) that you look at setting up c3p0
parameters to periodically test and discard stale connections. Does
anybody (maybe Indian team) have a good sample config?

Regards
Bob

···

On 4 July 2010 13:09, Orvalho Augusto <orvaquim@gmail.com> wrote:

It will give some job because we developed a tool to convert data from one
database to MySQL.

It is the only thing I can try to do to solve.

Caveman

On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring <knutst@gmail.com> wrote:

Is postgres out of the question?

On Jul 4, 2010 5:59 AM, "Orvalho Augusto" <orvaquim@gmail.com> wrote:

I do not know what to do. I have found this:

http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html

And what makes me feel really bad is:
"22.3.5.3.4: I have a servlet/application that works fine for a day, and
then stops working overnight MySQL closes connections after 8 hours of
inactivity. You either need to use a connection pool that handles stale
connections or use the "autoReconnect" parameter"

and
"The autoReconnect facility is deprecated, and may be removed in a future
release. "

So what we do?

Caveman

On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe <bobjolliffe@gmail.com>
wrote: > > Hi > > It looks...

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

Thanks for help.

Postgres I will use if I do not have a solution.

I will try things on the connection pool.

One very important note:
I have used DHIS 2.01 for almost a year and never happened to have these errors on the same Fedora Server as described before. I have tried some snapshot versions and again never had this.

I jumped from 2.01 to 2.04 and I start with MySQL troubles.

Caveman

···

On Mon, Jul 5, 2010 at 10:20 AM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Orvalho

Whereas I do agree postgres might solve your problems it does seem

like a drastic solution to this problem. The fact is mysql does

actually work and apparently work well so it should be possible to

solve this.

Trying to think logically here … you have another similar setup

where everything seems ok. I suppose the load could be quite

different on the two servers, but lets discount that for a bit. If

you are reusing old stale and broken connections then the only three

places i can think to look are:

(i) the jdbc driver (version compatibility). I think you checked that.

(ii) tcp/ip problems

(iii) the connection pool

Regarding (ii) can you check the value of bind-address in

/etc/mysql/my.cnf (or whatever config file you are using). This

should be set to 127.0.0.1 unless you are connecting to the db from a

different host. At least this interface will always be up so you

shouldnt get intermittent network errors on it.

Regarding (iii) I suggest (as above) that you look at setting up c3p0

parameters to periodically test and discard stale connections. Does

anybody (maybe Indian team) have a good sample config?

Regards

Bob

On 4 July 2010 13:09, Orvalho Augusto orvaquim@gmail.com wrote:

It will give some job because we developed a tool to convert data from one

database to MySQL.

It is the only thing I can try to do to solve.

Caveman

On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring knutst@gmail.com wrote:

Is postgres out of the question?

On Jul 4, 2010 5:59 AM, “Orvalho Augusto” orvaquim@gmail.com wrote:

I do not know what to do. I have found this:

http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html

And what makes me feel really bad is:

"22.3.5.3.4: I have a servlet/application that works fine for a day, and

then stops working overnight MySQL closes connections after 8 hours of

inactivity. You either need to use a connection pool that handles stale

connections or use the “autoReconnect” parameter"

and

"The autoReconnect facility is deprecated, and may be removed in a future

release. "

So what we do?

Caveman

On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe bobjolliffe@gmail.com

wrote: > > Hi > > It looks…


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Searching back through some old mail I see something similar has
surfaced before in this bug report:
https://bugs.launchpad.net/dhis2/+bug/534567

Also there was an issue with one of the servers in India which also
used mysql where I had a look at the log file and found an
inexplicably large number of threads blocked in a write operation
which I now suspect is also related.

It seems that some care needs to be taken to manage the mysql
connection pool over time. And as I suggested above I believe
(suspect!) the way to do that might be to proactively manage the
connection threads using c3p0's idleTestperiod property. Note I am no
hibernate or c3p0 expert.

I do recall from the "old days" perhaps around 2.01 we were commonly
setting c3p0 related properties in the hibernate.properties file. I
also remember (but can't find a reference) some suggestion of dropping
this. Lars, do you remember why we don't have these parameters set in
the hibernate.properties any more? I have a funny feeling that they
are required to keep long running mysql installations alive and
kicking.

Regards
Bob

···

On 5 July 2010 17:39, Orvalho Augusto <orvaquim@gmail.com> wrote:

Thanks for help.

Postgres I will use if I do not have a solution.

I will try things on the connection pool.

One very important note:
I have used DHIS 2.01 for almost a year and never happened to have these
errors on the same Fedora Server as described before. I have tried some
snapshot versions and again never had this.
I jumped from 2.01 to 2.04 and I start with MySQL troubles.

Caveman

On Mon, Jul 5, 2010 at 10:20 AM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Hi Orvalho

Whereas I do agree postgres might solve your problems it does seem
like a drastic solution to this problem. The fact is mysql does
actually work and apparently work well so it should be possible to
solve this.

Trying to think logically here ... you have another similar setup
where everything seems ok. I suppose the load could be quite
different on the two servers, but lets discount that for a bit. If
you are reusing old stale and broken connections then the only three
places i can think to look are:
(i) the jdbc driver (version compatibility). I think you checked that.
(ii) tcp/ip problems
(iii) the connection pool

Regarding (ii) can you check the value of bind-address in
/etc/mysql/my.cnf (or whatever config file you are using). This
should be set to 127.0.0.1 unless you are connecting to the db from a
different host. At least this interface will always be up so you
shouldnt get intermittent network errors on it.

Regarding (iii) I suggest (as above) that you look at setting up c3p0
parameters to periodically test and discard stale connections. Does
anybody (maybe Indian team) have a good sample config?

Regards
Bob

On 4 July 2010 13:09, Orvalho Augusto <orvaquim@gmail.com> wrote:
> It will give some job because we developed a tool to convert data from
> one
> database to MySQL.
>
> It is the only thing I can try to do to solve.
>
> Caveman
>
>
>
> On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring <knutst@gmail.com> wrote:
>>
>> Is postgres out of the question?
>>
>> On Jul 4, 2010 5:59 AM, "Orvalho Augusto" <orvaquim@gmail.com> wrote:
>>
>> I do not know what to do. I have found this:
>>
>>
>> http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html
>>
>> And what makes me feel really bad is:
>> "22.3.5.3.4: I have a servlet/application that works fine for a day,
>> and
>> then stops working overnight MySQL closes connections after 8 hours of
>> inactivity. You either need to use a connection pool that handles stale
>> connections or use the "autoReconnect" parameter"
>>
>> and
>> "The autoReconnect facility is deprecated, and may be removed in a
>> future
>> release. "
>>
>>
>> So what we do?
>>
>> Caveman
>>
>> On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe <bobjolliffe@gmail.com>
>> wrote: > > Hi > > It looks...
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help : https://help.launchpad.net/ListHelp
>>
>
>
>
>

Searching back through some old mail I see something similar has
surfaced before in this bug report:
https://bugs.launchpad.net/dhis2/+bug/534567

Also there was an issue with one of the servers in India which also
used mysql where I had a look at the log file and found an
inexplicably large number of threads blocked in a write operation
which I now suspect is also related.

It seems that some care needs to be taken to manage the mysql
connection pool over time. And as I suggested above I believe
(suspect!) the way to do that might be to proactively manage the
connection threads using c3p0's idleTestperiod property. Note I am no
hibernate or c3p0 expert.

I do recall from the "old days" perhaps around 2.01 we were commonly
setting c3p0 related properties in the hibernate.properties file. I
also remember (but can't find a reference) some suggestion of dropping
this. Lars, do you remember why we don't have these parameters set in
the hibernate.properties any more? I have a funny feeling that they
are required to keep long running mysql installations alive and
kicking.

Sorry, can't remember.

Indians have been running dhis on mysql for a long time now, good if
you could provide some input...

···

On Mon, Jul 5, 2010 at 11:44 PM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Regards
Bob

On 5 July 2010 17:39, Orvalho Augusto <orvaquim@gmail.com> wrote:

Thanks for help.

Postgres I will use if I do not have a solution.

I will try things on the connection pool.

One very important note:
I have used DHIS 2.01 for almost a year and never happened to have these
errors on the same Fedora Server as described before. I have tried some
snapshot versions and again never had this.
I jumped from 2.01 to 2.04 and I start with MySQL troubles.

Caveman

On Mon, Jul 5, 2010 at 10:20 AM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Hi Orvalho

Whereas I do agree postgres might solve your problems it does seem
like a drastic solution to this problem. The fact is mysql does
actually work and apparently work well so it should be possible to
solve this.

Trying to think logically here ... you have another similar setup
where everything seems ok. I suppose the load could be quite
different on the two servers, but lets discount that for a bit. If
you are reusing old stale and broken connections then the only three
places i can think to look are:
(i) the jdbc driver (version compatibility). I think you checked that.
(ii) tcp/ip problems
(iii) the connection pool

Regarding (ii) can you check the value of bind-address in
/etc/mysql/my.cnf (or whatever config file you are using). This
should be set to 127.0.0.1 unless you are connecting to the db from a
different host. At least this interface will always be up so you
shouldnt get intermittent network errors on it.

Regarding (iii) I suggest (as above) that you look at setting up c3p0
parameters to periodically test and discard stale connections. Does
anybody (maybe Indian team) have a good sample config?

Regards
Bob

On 4 July 2010 13:09, Orvalho Augusto <orvaquim@gmail.com> wrote:
> It will give some job because we developed a tool to convert data from
> one
> database to MySQL.
>
> It is the only thing I can try to do to solve.
>
> Caveman
>
>
>
> On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring <knutst@gmail.com> wrote:
>>
>> Is postgres out of the question?
>>
>> On Jul 4, 2010 5:59 AM, "Orvalho Augusto" <orvaquim@gmail.com> wrote:
>>
>> I do not know what to do. I have found this:
>>
>>
>> http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html
>>
>> And what makes me feel really bad is:
>> "22.3.5.3.4: I have a servlet/application that works fine for a day,
>> and
>> then stops working overnight MySQL closes connections after 8 hours of
>> inactivity. You either need to use a connection pool that handles stale
>> connections or use the "autoReconnect" parameter"
>>
>> and
>> "The autoReconnect facility is deprecated, and may be removed in a
>> future
>> release. "
>>
>>
>> So what we do?
>>
>> Caveman
>>
>> On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe <bobjolliffe@gmail.com>
>> wrote: > > Hi > > It looks...
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help : https://help.launchpad.net/ListHelp
>>
>
>
>
>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

I do not know what it made stop for now.

But I did this:

  1. Increase MySQL connection timeout for iddle connections by adding on my.cnf under mysqld section
    wait_timeout = 80000
    interactive_timeout = 80000

Place both. wait_timeout is affected by interactive_timeout (the MySQL doc says so).

  1. c3p0
    JAVA_OPTS I added this -Dc3p0.maxIdleTime=1800 -Dc3p0.maxIdleTime=3600 -Dc3p0.maxPoolSize=20

And I have placeded the c3p0 jar files under $JAVA_HOME/jre/lib/ext [is not beautiful].

On weekend I will remove one of them and see what happens. But It has gone for now.

Caveman

···

2010/7/8 Lars Helge Øverland larshelge@gmail.com

On Mon, Jul 5, 2010 at 11:44 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Searching back through some old mail I see something similar has

surfaced before in this bug report:

https://bugs.launchpad.net/dhis2/+bug/534567

Also there was an issue with one of the servers in India which also

used mysql where I had a look at the log file and found an

inexplicably large number of threads blocked in a write operation

which I now suspect is also related.

It seems that some care needs to be taken to manage the mysql

connection pool over time. And as I suggested above I believe

(suspect!) the way to do that might be to proactively manage the

connection threads using c3p0’s idleTestperiod property. Note I am no

hibernate or c3p0 expert.

I do recall from the “old days” perhaps around 2.01 we were commonly

setting c3p0 related properties in the hibernate.properties file. I

also remember (but can’t find a reference) some suggestion of dropping

this. Lars, do you remember why we don’t have these parameters set in

the hibernate.properties any more? I have a funny feeling that they

are required to keep long running mysql installations alive and

kicking.

Sorry, can’t remember.

Indians have been running dhis on mysql for a long time now, good if

you could provide some input…

Regards

Bob

On 5 July 2010 17:39, Orvalho Augusto orvaquim@gmail.com wrote:

Thanks for help.

Postgres I will use if I do not have a solution.

I will try things on the connection pool.

One very important note:

I have used DHIS 2.01 for almost a year and never happened to have these

errors on the same Fedora Server as described before. I have tried some

snapshot versions and again never had this.

I jumped from 2.01 to 2.04 and I start with MySQL troubles.

Caveman

On Mon, Jul 5, 2010 at 10:20 AM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Hi Orvalho

Whereas I do agree postgres might solve your problems it does seem

like a drastic solution to this problem. The fact is mysql does

actually work and apparently work well so it should be possible to

solve this.

Trying to think logically here … you have another similar setup

where everything seems ok. I suppose the load could be quite

different on the two servers, but lets discount that for a bit. If

you are reusing old stale and broken connections then the only three

places i can think to look are:

(i) the jdbc driver (version compatibility). I think you checked that.

(ii) tcp/ip problems

(iii) the connection pool

Regarding (ii) can you check the value of bind-address in

/etc/mysql/my.cnf (or whatever config file you are using). This

should be set to 127.0.0.1 unless you are connecting to the db from a

different host. At least this interface will always be up so you

shouldnt get intermittent network errors on it.

Regarding (iii) I suggest (as above) that you look at setting up c3p0

parameters to periodically test and discard stale connections. Does

anybody (maybe Indian team) have a good sample config?

Regards

Bob

On 4 July 2010 13:09, Orvalho Augusto orvaquim@gmail.com wrote:

It will give some job because we developed a tool to convert data from

one

database to MySQL.

It is the only thing I can try to do to solve.

Caveman

On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring knutst@gmail.com wrote:

Is postgres out of the question?

On Jul 4, 2010 5:59 AM, “Orvalho Augusto” orvaquim@gmail.com wrote:

I do not know what to do. I have found this:

http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html

And what makes me feel really bad is:

"22.3.5.3.4: I have a servlet/application that works fine for a day,

and

then stops working overnight MySQL closes connections after 8 hours of

inactivity. You either need to use a connection pool that handles stale

connections or use the “autoReconnect” parameter"

and

"The autoReconnect facility is deprecated, and may be removed in a

future

release. "

So what we do?

Caveman

On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe bobjolliffe@gmail.com

wrote: > > Hi > > It looks…


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Orvalho

Thanks for looking in to this. Its important that we get to the bottom of it.

I do not know what it made stop for now.

But I did this:
1. Increase MySQL connection timeout for iddle connections by adding on
my.cnf under mysqld section
wait_timeout = 80000
interactive_timeout = 80000

Place both. wait_timeout is affected by interactive_timeout (the MySQL doc
says so).

So you have increased the time Mysql will sit with idle connections
from 8 hours to 22 hours. It will still drop them eventually -
particularly over the weekend :slight_smile: From mysql's perspective its a
performance/resource thing. Each open connection is hogging a thread.
So if a connection sits idle for too long its going to reclaim it
eventually. The trick is to make our client (hibernate+c3p0) a bit
defensive to this behaviour.

2. c3p0
JAVA_OPTS I added this -Dc3p0.maxIdleTime=1800 -Dc3p0.maxIdleTime=3600
-Dc3p0.maxPoolSize=20

And I have placeded the c3p0 jar files under $JAVA_HOME/jre/lib/ext [is not
beautiful].

There is already a c3p0 jar shipped with dhis alongside hibernate (in
the WEB-INF/lib directory) so you shouldn't need to add your extra one
which as you say is not beautiful.

Also, to the best of my knowledge (I'm going to try some settings in a
minute), the c3p0 settings can be configured in the
hibernate.properties file which is slightly more beautiful than
setting JAVA_OPTS.

Regarding the actual values to set, I think you might be on to
something. My suggestion was to set c3p0 so that it periodically
checked connections to see if they were still live. That's a good
defensive strategy where you don't have control of both ends of the
puzzle ie. mysql and c3p0. But where you know the idle time on the
mysql server (as you do because you set it), then it might well be
sufficient to set the maxIdle time on c3p0 to be just under the
maxidle time of mysql. So c3p0 should never hold open idle
connections for longer than mysql's timeout period. That is your case
currently though the difference is quite extreme.

Note that by my reading of the defaults then the out-of-the-box
hibernate/c3p0/mysql setup is fragile. Mysql has a default timeout of
it's connections of 8 hours. c3p0 has a default of unlimited time.
So you folk running longstanding production mysql servers *must* be
seeing this. Again would be good to hear of any database experiences
from India. You guys have the most experience of running mysql
production servers.

I'm going to do a quick experiment with ridiculously short timeouts
and let you know what I find ....

Cheers
Bob

···

2010/7/9 Orvalho Augusto <orvaquim@gmail.com>:

On weekend I will remove one of them and see what happens. But It has gone
for now.

Caveman

2010/7/8 Lars Helge Øverland <larshelge@gmail.com>

On Mon, Jul 5, 2010 at 11:44 PM, Bob Jolliffe <bobjolliffe@gmail.com> >> wrote:
> Searching back through some old mail I see something similar has
> surfaced before in this bug report:
> https://bugs.launchpad.net/dhis2/+bug/534567
>
> Also there was an issue with one of the servers in India which also
> used mysql where I had a look at the log file and found an
> inexplicably large number of threads blocked in a write operation
> which I now suspect is also related.
>
> It seems that some care needs to be taken to manage the mysql
> connection pool over time. And as I suggested above I believe
> (suspect!) the way to do that might be to proactively manage the
> connection threads using c3p0's idleTestperiod property. Note I am no
> hibernate or c3p0 expert.
>
> I do recall from the "old days" perhaps around 2.01 we were commonly
> setting c3p0 related properties in the hibernate.properties file. I
> also remember (but can't find a reference) some suggestion of dropping
> this. Lars, do you remember why we don't have these parameters set in
> the hibernate.properties any more? I have a funny feeling that they
> are required to keep long running mysql installations alive and
> kicking.
>

Sorry, can't remember.

Indians have been running dhis on mysql for a long time now, good if
you could provide some input...

> Regards
> Bob
>
> On 5 July 2010 17:39, Orvalho Augusto <orvaquim@gmail.com> wrote:
>> Thanks for help.
>>
>> Postgres I will use if I do not have a solution.
>>
>> I will try things on the connection pool.
>>
>> One very important note:
>> I have used DHIS 2.01 for almost a year and never happened to have
>> these
>> errors on the same Fedora Server as described before. I have tried some
>> snapshot versions and again never had this.
>> I jumped from 2.01 to 2.04 and I start with MySQL troubles.
>>
>> Caveman
>>
>>
>> On Mon, Jul 5, 2010 at 10:20 AM, Bob Jolliffe <bobjolliffe@gmail.com> >> >> wrote:
>>>
>>> Hi Orvalho
>>>
>>> Whereas I do agree postgres might solve your problems it does seem
>>> like a drastic solution to this problem. The fact is mysql does
>>> actually work and apparently work well so it should be possible to
>>> solve this.
>>>
>>> Trying to think logically here ... you have another similar setup
>>> where everything seems ok. I suppose the load could be quite
>>> different on the two servers, but lets discount that for a bit. If
>>> you are reusing old stale and broken connections then the only three
>>> places i can think to look are:
>>> (i) the jdbc driver (version compatibility). I think you checked
>>> that.
>>> (ii) tcp/ip problems
>>> (iii) the connection pool
>>>
>>> Regarding (ii) can you check the value of bind-address in
>>> /etc/mysql/my.cnf (or whatever config file you are using). This
>>> should be set to 127.0.0.1 unless you are connecting to the db from a
>>> different host. At least this interface will always be up so you
>>> shouldnt get intermittent network errors on it.
>>>
>>> Regarding (iii) I suggest (as above) that you look at setting up c3p0
>>> parameters to periodically test and discard stale connections. Does
>>> anybody (maybe Indian team) have a good sample config?
>>>
>>> Regards
>>> Bob
>>>
>>> On 4 July 2010 13:09, Orvalho Augusto <orvaquim@gmail.com> wrote:
>>> > It will give some job because we developed a tool to convert data
>>> > from
>>> > one
>>> > database to MySQL.
>>> >
>>> > It is the only thing I can try to do to solve.
>>> >
>>> > Caveman
>>> >
>>> >
>>> >
>>> > On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring <knutst@gmail.com> >> >>> > wrote:
>>> >>
>>> >> Is postgres out of the question?
>>> >>
>>> >> On Jul 4, 2010 5:59 AM, "Orvalho Augusto" <orvaquim@gmail.com> >> >>> >> wrote:
>>> >>
>>> >> I do not know what to do. I have found this:
>>> >>
>>> >>
>>> >>
>>> >> http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html
>>> >>
>>> >> And what makes me feel really bad is:
>>> >> "22.3.5.3.4: I have a servlet/application that works fine for a
>>> >> day,
>>> >> and
>>> >> then stops working overnight MySQL closes connections after 8 hours
>>> >> of
>>> >> inactivity. You either need to use a connection pool that handles
>>> >> stale
>>> >> connections or use the "autoReconnect" parameter"
>>> >>
>>> >> and
>>> >> "The autoReconnect facility is deprecated, and may be removed in a
>>> >> future
>>> >> release. "
>>> >>
>>> >>
>>> >> So what we do?
>>> >>
>>> >> Caveman
>>> >>
>>> >> On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe
>>> >> <bobjolliffe@gmail.com>
>>> >> wrote: > > Hi > > It looks...
>>> >>
>>> >> _______________________________________________
>>> >> Mailing list: https://launchpad.net/~dhis2-devs
>>> >> Post to : dhis2-devs@lists.launchpad.net
>>> >> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> >> More help : https://help.launchpad.net/ListHelp
>>> >>
>>> >
>>> >
>>> >
>>> >
>>
>>
>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>

OK here's what I've done:

- set wait_timeout on mysql to 60 seconds.
- start up dhis2 and watch the connections using mysql workbench. I
also turned up c3p0 logging with 'log4j.category.com.mchange = DEBUG,
console' to watch the pool being managed at the dhis side.
- 3 connections are made prior to login and sit idel
- after 60 seconds of idle time mysql throws them out
- try to login to dhis now and you get the dreaded error

Two ways which keep everything alive are:
(i) test the idle connections every now and again (eg
-Dc3p0.idleConnectionTestPeriod=30). This way from the mysql
perspective they never go idle so are never thrown out.
(ii) set a max age for idle connections - Orvalho's solution (eg
-Dc3p0.maxIdleTime=30) - before they are recreated afresh.

Either of the above seem to do the trick as far as mysql is concerned.
But if you don't do one or the other (or perhaps a combination of the
two) then your connection with mysql will fall over eventually.

One problem I have is that setting these properties via the hibernate
properties file is not working for me. They are simply ignored :frowning:
This is a problem, particularly as you might want to change the pool
size settings from the default (which seems from observation to be
minimum 3 / maximum 15 connections) to something which scales better
to your use case. Again I am sure this is the case for the Indian
servers. Anyway I have tried the following in my
hibernate.properties:

···

########################################################
# connection pool configuration
#
########################################################

# keep idle connections around for 30 minutes
hibernate.c3p0.timeout = 1800

# test idle connections every 5 minutes
hibernate.c3p0.idle_test_period = 300

# minimum pool size
hibernate.c3p0.min_size = 5

# maximum pool size
hibernate.c3p0.max_size = 20

#########################################################

But it has no effect :frowning: Probably I am doing something stupid. Maybe
someone can investigate further.

Regards
Bob

On 9 July 2010 10:17, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Hi Orvalho

Thanks for looking in to this. Its important that we get to the bottom of it.

2010/7/9 Orvalho Augusto <orvaquim@gmail.com>:

I do not know what it made stop for now.

But I did this:
1. Increase MySQL connection timeout for iddle connections by adding on
my.cnf under mysqld section
wait_timeout = 80000
interactive_timeout = 80000

Place both. wait_timeout is affected by interactive_timeout (the MySQL doc
says so).

So you have increased the time Mysql will sit with idle connections
from 8 hours to 22 hours. It will still drop them eventually -
particularly over the weekend :slight_smile: From mysql's perspective its a
performance/resource thing. Each open connection is hogging a thread.
So if a connection sits idle for too long its going to reclaim it
eventually. The trick is to make our client (hibernate+c3p0) a bit
defensive to this behaviour.

2. c3p0
JAVA_OPTS I added this -Dc3p0.maxIdleTime=1800 -Dc3p0.maxIdleTime=3600
-Dc3p0.maxPoolSize=20

And I have placeded the c3p0 jar files under $JAVA_HOME/jre/lib/ext [is not
beautiful].

There is already a c3p0 jar shipped with dhis alongside hibernate (in
the WEB-INF/lib directory) so you shouldn't need to add your extra one
which as you say is not beautiful.

Also, to the best of my knowledge (I'm going to try some settings in a
minute), the c3p0 settings can be configured in the
hibernate.properties file which is slightly more beautiful than
setting JAVA_OPTS.

Regarding the actual values to set, I think you might be on to
something. My suggestion was to set c3p0 so that it periodically
checked connections to see if they were still live. That's a good
defensive strategy where you don't have control of both ends of the
puzzle ie. mysql and c3p0. But where you know the idle time on the
mysql server (as you do because you set it), then it might well be
sufficient to set the maxIdle time on c3p0 to be just under the
maxidle time of mysql. So c3p0 should never hold open idle
connections for longer than mysql's timeout period. That is your case
currently though the difference is quite extreme.

Note that by my reading of the defaults then the out-of-the-box
hibernate/c3p0/mysql setup is fragile. Mysql has a default timeout of
it's connections of 8 hours. c3p0 has a default of unlimited time.
So you folk running longstanding production mysql servers *must* be
seeing this. Again would be good to hear of any database experiences
from India. You guys have the most experience of running mysql
production servers.

I'm going to do a quick experiment with ridiculously short timeouts
and let you know what I find ....

Cheers
Bob

On weekend I will remove one of them and see what happens. But It has gone
for now.

Caveman

2010/7/8 Lars Helge Øverland <larshelge@gmail.com>

On Mon, Jul 5, 2010 at 11:44 PM, Bob Jolliffe <bobjolliffe@gmail.com> >>> wrote:
> Searching back through some old mail I see something similar has
> surfaced before in this bug report:
> https://bugs.launchpad.net/dhis2/+bug/534567
>
> Also there was an issue with one of the servers in India which also
> used mysql where I had a look at the log file and found an
> inexplicably large number of threads blocked in a write operation
> which I now suspect is also related.
>
> It seems that some care needs to be taken to manage the mysql
> connection pool over time. And as I suggested above I believe
> (suspect!) the way to do that might be to proactively manage the
> connection threads using c3p0's idleTestperiod property. Note I am no
> hibernate or c3p0 expert.
>
> I do recall from the "old days" perhaps around 2.01 we were commonly
> setting c3p0 related properties in the hibernate.properties file. I
> also remember (but can't find a reference) some suggestion of dropping
> this. Lars, do you remember why we don't have these parameters set in
> the hibernate.properties any more? I have a funny feeling that they
> are required to keep long running mysql installations alive and
> kicking.
>

Sorry, can't remember.

Indians have been running dhis on mysql for a long time now, good if
you could provide some input...

> Regards
> Bob
>
> On 5 July 2010 17:39, Orvalho Augusto <orvaquim@gmail.com> wrote:
>> Thanks for help.
>>
>> Postgres I will use if I do not have a solution.
>>
>> I will try things on the connection pool.
>>
>> One very important note:
>> I have used DHIS 2.01 for almost a year and never happened to have
>> these
>> errors on the same Fedora Server as described before. I have tried some
>> snapshot versions and again never had this.
>> I jumped from 2.01 to 2.04 and I start with MySQL troubles.
>>
>> Caveman
>>
>>
>> On Mon, Jul 5, 2010 at 10:20 AM, Bob Jolliffe <bobjolliffe@gmail.com> >>> >> wrote:
>>>
>>> Hi Orvalho
>>>
>>> Whereas I do agree postgres might solve your problems it does seem
>>> like a drastic solution to this problem. The fact is mysql does
>>> actually work and apparently work well so it should be possible to
>>> solve this.
>>>
>>> Trying to think logically here ... you have another similar setup
>>> where everything seems ok. I suppose the load could be quite
>>> different on the two servers, but lets discount that for a bit. If
>>> you are reusing old stale and broken connections then the only three
>>> places i can think to look are:
>>> (i) the jdbc driver (version compatibility). I think you checked
>>> that.
>>> (ii) tcp/ip problems
>>> (iii) the connection pool
>>>
>>> Regarding (ii) can you check the value of bind-address in
>>> /etc/mysql/my.cnf (or whatever config file you are using). This
>>> should be set to 127.0.0.1 unless you are connecting to the db from a
>>> different host. At least this interface will always be up so you
>>> shouldnt get intermittent network errors on it.
>>>
>>> Regarding (iii) I suggest (as above) that you look at setting up c3p0
>>> parameters to periodically test and discard stale connections. Does
>>> anybody (maybe Indian team) have a good sample config?
>>>
>>> Regards
>>> Bob
>>>
>>> On 4 July 2010 13:09, Orvalho Augusto <orvaquim@gmail.com> wrote:
>>> > It will give some job because we developed a tool to convert data
>>> > from
>>> > one
>>> > database to MySQL.
>>> >
>>> > It is the only thing I can try to do to solve.
>>> >
>>> > Caveman
>>> >
>>> >
>>> >
>>> > On Sun, Jul 4, 2010 at 8:16 AM, Knut Staring <knutst@gmail.com> >>> >>> > wrote:
>>> >>
>>> >> Is postgres out of the question?
>>> >>
>>> >> On Jul 4, 2010 5:59 AM, "Orvalho Augusto" <orvaquim@gmail.com> >>> >>> >> wrote:
>>> >>
>>> >> I do not know what to do. I have found this:
>>> >>
>>> >>
>>> >>
>>> >> http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-troubleshooting.html
>>> >>
>>> >> And what makes me feel really bad is:
>>> >> "22.3.5.3.4: I have a servlet/application that works fine for a
>>> >> day,
>>> >> and
>>> >> then stops working overnight MySQL closes connections after 8 hours
>>> >> of
>>> >> inactivity. You either need to use a connection pool that handles
>>> >> stale
>>> >> connections or use the "autoReconnect" parameter"
>>> >>
>>> >> and
>>> >> "The autoReconnect facility is deprecated, and may be removed in a
>>> >> future
>>> >> release. "
>>> >>
>>> >>
>>> >> So what we do?
>>> >>
>>> >> Caveman
>>> >>
>>> >> On Mon, Jun 28, 2010 at 12:59 PM, Bob Jolliffe
>>> >> <bobjolliffe@gmail.com>
>>> >> wrote: > > Hi > > It looks...
>>> >>
>>> >> _______________________________________________
>>> >> Mailing list: https://launchpad.net/~dhis2-devs
>>> >> Post to : dhis2-devs@lists.launchpad.net
>>> >> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> >> More help : https://help.launchpad.net/ListHelp
>>> >>
>>> >
>>> >
>>> >
>>> >
>>
>>
>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>