[JDBC] Error 'Received resultset tuples, but no field structure for them' onqueries subsequent to an error
От | Christina Simpson |
---|---|
Тема | [JDBC] Error 'Received resultset tuples, but no field structure for them' onqueries subsequent to an error |
Дата | |
Msg-id | EFF4BB98-7350-426A-A8B7-4284E3C5F061@xmatters.com обсуждение исходный текст |
Ответы |
Re: [JDBC] Error 'Received resultset tuples, but no field structurefor them' on queries subsequent to an error
|
Список | pgsql-jdbc |
Hi. I am working through an upgrade of JDBC drivers to version 42.1.4. After the upgrade we were getting the following error in one of our tests. It was only occurring when several tests were run together and running the failing test by itself passed.
The error is:
java.lang.IllegalStateException: Received resultset tuples, but no field structure for them
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2121)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:117)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:692)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:684)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:711)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.query(NamedParameterJdbcTemplate.java:154)
I’ve been able to simplify the test failures with some possibly interesting results and have narrowed down the failure to use a single select query that contains a UUID (it is cast as a uuid in the query) but we are passing to spring jdbc template as a string. If exactly the fifth query contains an invalid uuid, the query fails as expected with this stack
Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax for uuid: "0b74c00c"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:117)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:692)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
I can trace through with the debugger and see that after the query fails, the cached statement is added back to the statement cache and the value for fields is reset to null.
It looks to be set to null in this method org.postgresql.core.v3.QueryExecutorImpl#sendParse
The next query to take that query out of the cache fails with the first error above. At first I thought it was extremely odd that this had to be exactly the fifth query but as I was debugging I noticed that at the value of prepareThreshold is 5.
This is smelling like a possible bug but I wanted to check with the experts. I can attempt to provide some more simplified code sample if needed but am hoping it may be easily reproduced with this report. I haven’t seen this error reported exactly like this but have seen some reports of people reporting this error then reporting that it just went away. Which might make sense if failed queries are getting released to the query cache and the fields values are reset but never set again but once that query falls off the LRU cache the problem goes away. I haven’t been able to find a work around yet but would love suggestions to try. Thanks.
В списке pgsql-jdbc по дате отправления:
Предыдущее
От: Michael GlaesemannДата:
Сообщение: [JDBC] [pgjdbc/pgjdbc] 634e15: refactor: use TypeInfo getPGArrayType insteadof m...
Следующее
От: Thach HoangДата:
Сообщение: [JDBC] [pgjdbc/pgjdbc] 279fb4: fix: always return Short[] forjava.sql.Array.getA...