2017-08-13 1 views
0

I utilisé postgresql 9.3 et 5.2 Liferaycom.liferay.portal.kernel.job.JobExecutionException: org.postgresql.util.PSQLException: Cette connexion a été fermée

correctement le fonctionnement du système, mais après un certain temps je I avez un problème de perte de connexion dans le fichier journal.

(org.springframework.scheduling.quartz.SchedulerFactoryBean#6e2243fb_Worker-2) 07:19:09,914 ERROR [JobWrapper:81] com.liferay.portal.kernel.job.JobExecutionException: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend. 
com.liferay.portal.kernel.job.JobExecutionException: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend. 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.execute(ConnectionHeartbeatJob.java:55) 
    at com.liferay.portal.job.JobWrapper.execute(JobWrapper.java:69) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529) 
Caused by: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend. 
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:226) 
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424) 
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:321) 
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313) 
    at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:1006) 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.sendHeartbeat(ConnectionHeartbeatJob.java:75) 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.execute(ConnectionHeartbeatJob.java:52) 
    ... 3 more 
Caused by: java.net.SocketException: Connection reset 
    at java.net.SocketInputStream.read(SocketInputStream.java:168) 
    at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:143) 
    at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:112) 
    at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:70) 
    at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:283) 
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1799) 
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200) 
    ... 9 more 
2017-08-13 08:19:09,901 INFO [STDOUT] (org.springframework.scheduling.quartz.SchedulerFactoryBean#6e2243fb_Worker-1) 08:19:09,901 WARN [NewPooledConnection:486] [c3p0] A PooledConnection that has already signalled a Connection error is still in use! 
2017-08-13 08:19:09,903 INFO [STDOUT] (org.springframework.scheduling.quartz.SchedulerFactoryBean#6e2243fb_Worker-1) 08:19:09,902 WARN [NewPooledConnection:487] [c3p0] Another error has occurred [ org.postgresql.util.PSQLException: This connection has been closed. ] which will not be reported to listeners! 
org.postgresql.util.PSQLException: This connection has been closed. 
    at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:786) 
    at org.postgresql.jdbc.PgConnection.createStatement(PgConnection.java:1598) 
    at org.postgresql.jdbc.PgConnection.createStatement(PgConnection.java:405) 
    at com.mchange.v2.c3p0.impl.NewProxyConnection.createStatement(NewProxyConnection.java:96) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:364) 
    at com.sun.proxy.$Proxy261.createStatement(Unknown Source) 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.sendHeartbeat(ConnectionHeartbeatJob.java:73) 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.execute(ConnectionHeartbeatJob.java:52) 
    at com.liferay.portal.job.JobWrapper.execute(JobWrapper.java:69) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529) 
2017-08-13 08:19:09,905 INFO [STDOUT] (org.springframework.scheduling.quartz.SchedulerFactoryBean#6e2243fb_Worker-1) 08:19:09,903 ERROR [JobWrapper:81] com.liferay.portal.kernel.job.JobExecutionException: org.postgresql.util.PSQLException: This connection has been closed. 
com.liferay.portal.kernel.job.JobExecutionException: org.postgresql.util.PSQLException: This connection has been closed. 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.execute(ConnectionHeartbeatJob.java:55) 
    at com.liferay.portal.job.JobWrapper.execute(JobWrapper.java:69) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529) 
Caused by: org.postgresql.util.PSQLException: This connection has been closed. 
    at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:786) 
    at org.postgresql.jdbc.PgConnection.createStatement(PgConnection.java:1598) 
    at org.postgresql.jdbc.PgConnection.createStatement(PgConnection.java:405) 
    at com.mchange.v2.c3p0.impl.NewProxyConnection.createStatement(NewProxyConnection.java:96) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:364) 
    at com.sun.proxy.$Proxy261.createStatement(Unknown Source) 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.sendHeartbeat(ConnectionHeartbeatJob.java:73) 
    at com.liferay.counter.service.persistence.ConnectionHeartbeatJob.execute(ConnectionHeartbeatJob.java:52) 
    ... 3 more 

ceci est ma configuration en portal-ext.properties:

# 
# PostgreSQL 
# 
jdbc.default.driverClassName=org.postgresql.Driver 
jdbc.default.url=jdbc:postgresql://192.168.2.3:5432/portal 
jdbc.default.username=postgres 
jdbc.default.password=postgres 

et je tente d'ajouter ces lignes, mais apparaissent toujours l'erreur:

jdbc.default.testConnectionOnCheckout=true 
jdbc.default.preferredTestQuery=SELECT 1 
jdbc.default.acquireIncrement=1 
jdbc.default.maxIdleTime=10800 
jdbc.default.maxConnectionAge=14400 
jdbc.default.numHelperThreads=20 

Je ne comprends pas l'erreur, Peut être un problème dans le réglage postgresql ou dans le réglage du pool de connexion dans liferay

J'ai cette ligne dans postgresql.conf qui peut être modifié pour résoudre ce problème:

#synchronous_standby_names = '' # standby servers that provide sync rep 
       # comma-separated list of application_name 
       # from standby(s); '*' = all 

Mise à jour:

Cette erreur est affiché dans le fichier journal en plusieurs fois, mais le première apparition est après quelques minutes peut-être prendre 1 heure. Je lance Postgresql dans un conteneur docker. Liferay et le conteneur de base de données se trouvent dans le même serveur physique.

Je ne sais pas pourquoi la connexion à la base de données est parfois inaccessible.

c'est la version docker:

docker version 
Client: 
Version:  17.06.0-ce 
API version: 1.30 
Go version: go1.8.3 
Git commit: 02c1d87 
Built:  Fri Jun 10 21:20:36 2017 
OS/Arch:  linux/amd64 

Server: 
Version:  17.06.0-ce 
API version: 1.30 (minimum version 1.12) 
Go version: go1.8.3 
Git commit: 02c1d87 
Built:  Fri Jun 10 21:21:56 2017 
OS/Arch:  linux/amd64 
Experimental: false 

Répondre

0

Wow, Liferay 5.2? Cela fait un moment ...

La première question est: Est-ce que cela apparaît souvent/à chaque fois? Pouvez-vous le reproduire ou était-ce juste une fois? Une raison fréquente de cette situation est lorsque Postgresql est mis à jour et redémarre. Si cela se produit lors d'une transaction, j'espère que Postgresql se fermera gracieusement, par ex. termine une transaction avant de fermer. D'autre part, avant qu'il ne redémarre, il sera inaccessible pendant un certain temps. Même lorsque Liferay (ou le pool de connexions) détermine que la connexion en cours est invalide (voir testQuery), il ne sera pas en mesure de se reconnecter pendant la période de panne du serveur. Et si Postgresql fonctionne sur un serveur différent de celui sur lequel Liferay s'exécute, il ne peut pas s'agir uniquement d'un redémarrage de la base de données elle-même, il peut s'agir d'un redémarrage complet du système d'exploitation. Naturellement, Liferay perdra la connexion pendant ce temps.

Comme vous ne donnez aucune autre indication sur les étapes à reproduire, je dirais que c'est une bonne supposition de départ. Sinon, plus d'informations sont nécessaires.

+0

merci pour votre réponse, j'ai mis à jour ma question, j'ai utilisé conteneur de base de données, je pense que postgreSQL n'a aucun problème à utiliser avec Docker, Cette erreur est affichée dans le fichier journal plusieurs fois, mais la première la minute peut prendre une heure. – franco