2014-02-21 135 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的日誌文件再次
相關問題