java.sql.SQLException: ERROR: canceling query due to user request
java.sql.SQLException: ERROR: canceling query due to user request
От:
"Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Дата:
The server is 8.0.3 running on Windows. The client is using the 311 build with some patches we need (from the stable branch). There is nothing we know of which would be canceling things on the server side, and nothing we know of which would be doing so on the JDBC client. (In fact, when this happens during invocation of the Connection.commit method, I don't think there is a way to cancel it programatically.)
A handful of these exceptions may be sprinkled throughout a stream of thousands of queries in the course of a minute. There is nothing we've been able to identify which differentiates the failing queries form those which succeed. There is one clue, though -- except for the case where they happen on Connection.commit, they all seem to happen during attempts to update a row through a ResultSet shortly after an exception (such as a duplicate key) was thrown, resulting in the rollback of the previous database transaction. (That is, Connection.rollback was invoked after catching the exception.) Connection.autoCommit is set to false.
Any suggestions regarding possible causes, possible workarounds, diagnostic steps we should pursue, etc. are welcome.
Below are some typical stack traces, from the point where we invoke a JDBC method. The executeUpdate method was invoked for an UPDATE statement.
java.sql.SQLException: ERROR: canceling query due to user request
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Connection.executeTransactionCommand(AbstractJdbc2Connection.java:625)
at org.postgresql.jdbc2.AbstractJdbc2Connection.commit(AbstractJdbc2Connection.java:645)
java.sql.SQLException: ERROR: canceling query due to user request
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:314)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:221)
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getPrimaryKeys(AbstractJdbc2DatabaseMetaData.java:3130)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.isUpdateable(AbstractJdbc2ResultSet.java:1583)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkUpdateable(AbstractJdbc2ResultSet.java:2444)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateValue(AbstractJdbc2ResultSet.java:2682)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1149)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1511)
java.sql.SQLException: ERROR: canceling query due to user request
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
at org.postgresql.core.Field.getColumnName(Field.java:247)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateValue(AbstractJdbc2ResultSet.java:2693)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1149)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateObject(AbstractJdbc2ResultSet.java:1511)
java.sql.SQLException: ERROR: canceling query due to user request
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
java.sql.SQLException: ERROR: canceling query due to user request
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRow(AbstractJdbc2ResultSet.java:1307)
Re: java.sql.SQLException: ERROR: canceling query due to user
От:
Oliver Jowett <oliver@opencloud.com>
Дата:
Kevin Grittner wrote: > The server is 8.0.3 running on Windows. The client is using the 311 build with some patches we need (from the stable branch). There is nothing we know of which would be canceling things on the server side, and nothing we know of which would be doing so on the JDBC client. (In fact, when this happens during invocation of the Connection.commit method, I don't think there is a way to cancel it programatically.) > java.sql.SQLException: ERROR: canceling query due to user request On a unix system I'd say that something is sending SIGINT to the backend process. Certainly, the JDBC driver never sends a cancel request unless you explicitly call Statement.cancel(), and as you say there's no way to cancel a commit(). I don't know what the equivalent to sending SIGINT in the win32 world is (there's some sort of signal emulation that the windows build uses?), but it sounds like something on the server side rather than a JDBC issue. -O
Re: java.sql.SQLException: ERROR: canceling query due to user
От:
Oliver Jowett <oliver@opencloud.com>
Дата:
Oliver Jowett wrote: > Kevin Grittner wrote: > >>The server is 8.0.3 running on Windows. The client is using the 311 build with some patches we need (from the stable branch). There is nothing we know of which would be canceling things on the server side, and nothing we know of which would be doing so on the JDBC client. (In fact, when this happens during invocation of the Connection.commit method, I don't think there is a way to cancel it programatically.) > > >>java.sql.SQLException: ERROR: canceling query due to user request > > > On a unix system I'd say that something is sending SIGINT to the backend > process. Certainly, the JDBC driver never sends a cancel request unless > you explicitly call Statement.cancel(), and as you say there's no way to > cancel a commit(). Oh -- another possibility is that you've set statement_timeout, which is implemented in the backend as sending a query cancel after the timeout. -O