JDBC error: Unexpected packet type: 25

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JDBC error: Unexpected packet type: 25

Ignacio Rey
Hello,

I'm sometimes getting this error from the PostgreSQL JDBC driver
(version 42.2.10):

        java.io.IOException: Unexpected packet type: 25

(Full stack trace at the end of this message).

Looks a lot like a bug or a version mismatch. The latter is unlikely
since the driver is relatively new but the server is a bit older (11.4).
If it were a bug I would expect more people to reproduce it, but I
haven't found anything on google (the only result is not even about
PostgreSQL).

For the moment I have no idea how to reproduce this error. It appears to
happen just randomly.

I'd like to know if someone can suggest a way to gather more information
so I can eventually turn it into reproducible steps and fill a bug report.

Also, can pg_bouncer be related?

Thanks.
Ignacio


Stack trace:

org.hibernate.TransactionException: commit failed
     at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:185)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]

     (8 stack frames of custom application software omitted)

     at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:1.8.0_191]
     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:1.8.0_191]
     at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_191]
     at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_191]
     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
Caused by: org.hibernate.TransactionException: unable to commit against
JDBC connection
     at
org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:116)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
     at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:178)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
     ... 13 more
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:338)
~[postgresql-42.2.10.jar:42.2.10]
     at
org.postgresql.jdbc.PgConnection.executeTransactionCommand(PgConnection.java:829)
~[postgresql-42.2.10.jar:42.2.10]
     at org.postgresql.jdbc.PgConnection.commit(PgConnection.java:851)
~[postgresql-42.2.10.jar:42.2.10]
     at
org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:112)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
     at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:178)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
     ... 13 more
Caused by: java.io.IOException: Unexpected packet type: 25
     at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2395)
~[postgresql-42.2.10.jar:42.2.10]
     at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:311)
~[postgresql-42.2.10.jar:42.2.10]
     at
org.postgresql.jdbc.PgConnection.executeTransactionCommand(PgConnection.java:829)
~[postgresql-42.2.10.jar:42.2.10]
     at org.postgresql.jdbc.PgConnection.commit(PgConnection.java:851)
~[postgresql-42.2.10.jar:42.2.10]
     at
org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:112)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
     at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:178)
~[hibernate-core-4.1.4.Final.jar:4.1.4.Final]
     ... 13 more


=> select version();
                                                  version

---------------------------------------------------------------------------------------------------------
  PostgreSQL 11.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-36), 64-bit
(1 row)


Reply | Threaded
Open this post in threaded view
|

Re: JDBC error: Unexpected packet type: 25

Vijaykumar Jain-2

" java.io.IOException: Unexpected packet type: 25"

char 25 is EM. ( End of Medium)
I do not see it being part of the wire protocol, as for the same reason, not in pgjdbc handling i think.


I may be diverting that may not be related but a few things, just in case.
1) we once had a scenario of a bad nic driver e1000, that resulted in a lot of pkt losses. 
We figured out there were too many pkt drops and upgraded the driver to vmnet or something.

2)You should also raise the same with pgjdbc. I see they have resolved issues with other mismatched packet types like 52 at their end.

3) I have had some arguments wrt pgjdbc/npgsql having issues with pgbouncer and not with postgresql directly. I counter by running the same queries using psql  with pgbouncer. never got an error. But I am not an expert with Java so I keep an open mind and also raise this with the driver owners just in case as well as pgbouncer. else it is a deadlock :)

although this one is different issue, can you reproduce this case like above ?