2014-02-21 169 views
3

我有一个与hibernate连接的web应用程序。应用程序正在连接到PostgreSQL数据库。有时我会在日志中看到例外情况。SQL错误:0,SQLState:08006

Caused by: **org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.** 
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) 
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) 
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) 
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252) 
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) 
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) 
at org.geotools.jdbc.JDBCFeatureReader.<init>(JDBCFeatureReader.java:150) 
at org.geotools.jdbc.JDBCFeatureSource.getReaderInternal(JDBCFeatureSource.java:567) 
... 101 more 
**Caused by: java.io.EOFException** 
at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:261) 
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1620) 
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) 






Caused by: org.postgresql.util.PSQLException: **An I/O error occured while sending to the backend.** 
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) 
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) 
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) 
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252) 
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) 
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) 
at org.geotools.jdbc.JDBCFeatureReader.<init>(JDBCFeatureReader.java:150) 
at org.geotools.jdbc.JDBCFeatureSource.getReaderInternal(JDBCFeatureSource.java:567) 
... 101 more 
**Caused by: java.net.SocketException: Connection reset** 
at java.net.SocketInputStream.read(Unknown Source) 
at java.net.SocketInputStream.read(Unknown Source) 
at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135) 
at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104) 
at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) 
at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259) 
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1620) 
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) 

可能是什么问题。有什么我需要改变它在我的休眠配置文件或任何代码问题。请给我你的建议?

找到我下面的hibernate配置

<property name="hibernate.c3p0.min_size">5</property> 
    <property name="hibernate.c3p0.max_size">20</property> 
    <property name="hibernate.c3p0.timeout">5000</property> 
    <property name="hibernate.c3p0.max_statements">0</property> 
    <property name="hibernate.c3p0.idle_test_period">3000</property> 

请找我下面的PostgreSQL的日志

2014-02-19 07:22:35 IST LOG: server process (PID 74813) was terminated by signal 6: Aborted 
2014-02-19 07:22:35 IST LOG: terminating any other active server processes 
2014-02-19 07:22:35 IST WARNING: terminating connection because of crash of another server process 
2014-02-19 07:22:35 IST DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. 
2014-02-19 07:22:35 IST HINT: In a moment you should be able to reconnect to the database and repeat your command. 
2014-02-19 07:22:35 IST WARNING: terminating connection because of crash of another server process 
2014-02-19 07:22:35 IST DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. 
2014-02-19 07:22:35 IST HINT: In a moment you should be able to reconnect to the database and repeat your command. 
2014-02-19 07:22:35 IST LOG: all server processes terminated; reinitializing 
2014-02-19 07:22:35 IST LOG: database system was interrupted; last known up at 2014-02-19 07:22:29 IST 
2014-02-19 07:22:35 IST LOG: database system was not properly shut down; automatic recovery in progress 
2014-02-19 07:22:35 IST LOG: record with zero length at 0/16D89BB0 
2014-02-19 07:22:35 IST LOG: redo is not required 
2014-02-19 07:22:35 IST LOG: autovacuum launcher started 
2014-02-19 07:22:35 IST LOG: database system is ready to accept connections 


2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 
2014-02-19 11:17:59 IST LOG: unexpected EOF on client connection 

我的服务器操作系统是 - 红帽企业Linux 6的64位 和PostgreSQL版本 - postgreSQL 9.1

+0

面向对象,这很有趣,它正在死于一个SIGABRT,可能是断言失败。在崩溃之前,日志中是否有任何内容?您正在使用哪种PostgreSQL版本* *? '请选择版本()'。并在什么操作系统/版本? –

回答

5

好吧,这很有趣:

2014-02-19 07:22:35 IST LOG: server process (PID 74813) was terminated by signal 6: Aborted

这表明PostgreSQL服务器后端崩溃。具体而言,信号6(SIGABRT)由断言失败触发,将代码故意崩溃是因为某些错误,并且无法继续执行而不会冒数据损坏的风险。

如果您没有运行PostgreSQL版本(您没有提到)的最新补丁版本,请立即更新。

(其余的是真的更多的问题,但SO的格式,有时使评论太限制性):

我建议用log_line_prefix至少包括后端的PID和交易ID进行log_statement = all。然后重新加载PostgreSQL以使设置处于活动状态。当下一个问题发生时,查看查询日志以查看崩溃过程在崩溃时执行的过程。看看是否在控制台上交互地运行相同的语句也会导致崩溃。

我还建议启用核心转储文件并下载PostgreSQL版本的debuginfo软件包。这将允许您将调试器附加到包含服务器崩溃时的状态的文件,并希望看到出错的文件。如何启用核心转储是特定于操作系统/发行版,并且您没有提及您的操作系统和版本,因此我无法提供更具体的说明;请参阅Google。

0

根据postgresql documentation,你遇到了connection_failure problem.So检查以下步骤,

  1. 检查您的网络连接配置到您的休眠 配置文件
  2. 检查数据库连接是否打开。
  3. 检查您的网络连接
  4. 以上都不行,请发表您的PostgreSQL的日志文件再次
相关问题