SQL Error: 0, SQLState: 08006

馋奶兔 提交于 2021-02-07 05:32:09

问题


I have a web application with hibernate connection. application is connecting to PostgreSQL db. Some times I am getting below exceptions in my logs.

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)

What might be the problem. Is there anything i need to change it in my hibernate configuration files or any code issues. Please give me your suggestions?

find the below my hibernate configuration

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

please find the below my postgreSQL logs

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

My Server OS is - Red Hat Enterprise Linux 6 64-bit and postgreSQL version - postgreSQL 9.1


回答1:


Ok, that's interesting:

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

That indicates that the PostgreSQL server backend is crashing. Specifically, signal 6 (SIGABRT) is triggered by assertion failures, places the code intentionally crashes because something is wrong and it can't continue without risking data corruption.

If you are not running the latest patch release of your PostgreSQL version (which you did not mention), update now.

(The rest is really more questions, but SO's format sometimes makes comments just too restrictive):

I recommend enabling log_statement = all with a log_line_prefix that includes at least the backend pid and transaction ID. Then reloading PostgreSQL to make the setting active. When the problem next happens, look in the query logs to see what the crashing process was executing at the time it crashed. See if running the same statement interactively on the console causes the crash too.

I also recommend enabling core dump files and downloading the debuginfo packages for your PostgreSQL version. This will allow you to attach a debugger to a file that contains the state of the server when it crashed, and hopefully see what went wrong. How to enable core-dumps is OS/distro specific and you haven't mentioned your operating system and version so I can't offer more specific instructions; see Google.




回答2:


According to postgresql documentation , you faced connection_failure problem.So check the following steps,

  1. Check your connection configuration into your hibernate configuration file
  2. Check your database connection is opened or not.
  3. Check your network connection
  4. The above are not ok please post your postgressql log file again



回答3:


In my case, this error was caused by truncates i have done on tables, but did not commit the transaction. (I used DBeaver tool)



来源:https://stackoverflow.com/questions/21925083/sql-error-0-sqlstate-08006

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!