← Back to team overview

dhis2-devs team mailing list archive

Re: Troubles with database communication

 

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
:-(

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@xxxxxxxxx> 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@xxxxxxxxx> 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.
>>
>> mysql> 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
>> --------------
>>
>> mysql> 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@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
>
> --
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+260968395190
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>



Follow ups

References