{"action":"created","issue":{"url":"https://api.github.com/repos/prestodb/presto/issues/4720","repository_url":"https://api.github.com/repos/prestodb/presto","labels_url":"https://api.github.com/repos/prestodb/presto/issues/4720/labels{/name}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/4720/comments","events_url":"https://api.github.com/repos/prestodb/presto/issues/4720/events","html_url":"https://github.com/prestodb/presto/pull/4720","id":138588300,"number":4720,"title":"Properly cancel query if the pager is aborted","user":{"login":"nezihyigitbasi","id":1223839,"avatar_url":"https://avatars.githubusercontent.com/u/1223839?v=3","gravatar_id":"","url":"https://api.github.com/users/nezihyigitbasi","html_url":"https://github.com/nezihyigitbasi","followers_url":"https://api.github.com/users/nezihyigitbasi/followers","following_url":"https://api.github.com/users/nezihyigitbasi/following{/other_user}","gists_url":"https://api.github.com/users/nezihyigitbasi/gists{/gist_id}","starred_url":"https://api.github.com/users/nezihyigitbasi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nezihyigitbasi/subscriptions","organizations_url":"https://api.github.com/users/nezihyigitbasi/orgs","repos_url":"https://api.github.com/users/nezihyigitbasi/repos","events_url":"https://api.github.com/users/nezihyigitbasi/events{/privacy}","received_events_url":"https://api.github.com/users/nezihyigitbasi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/prestodb/presto/labels/CLA%20Signed","name":"CLA Signed","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-04T21:18:58Z","updated_at":"2016-04-12T17:55:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/4720","html_url":"https://github.com/prestodb/presto/pull/4720","diff_url":"https://github.com/prestodb/presto/pull/4720.diff","patch_url":"https://github.com/prestodb/presto/pull/4720.patch"},"body":"When the pager is aborted the main thread gets interrupted and statement client `close()` is called with the interrupt flag of the main thread set. This causes an `java.nio.channels.ClosedByInterruptException` under the hood when making the http call, which fails silently leaving the query running until it gets canceled due to inactivity.\r\n\r\nHere is the stack trace of the exception that I was able to collect with the debugger:\r\n\r\n```Java\r\norg.eclipse.jetty.io.EofException\r\n\tat org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:197)\r\n\tat org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:419)\r\n\tat org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:313)\r\n\tat org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:141)\r\n\tat org.eclipse.jetty.client.http.HttpSenderOverHTTP$HeadersCallback.process(HttpSenderOverHTTP.java:230)\r\n\tat org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)\r\n\tat org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:224)\r\n\tat org.eclipse.jetty.client.http.HttpSenderOverHTTP.sendHeaders(HttpSenderOverHTTP.java:58)\r\n\tat org.eclipse.jetty.client.HttpSender.send(HttpSender.java:204)\r\n\tat org.eclipse.jetty.client.http.HttpChannelOverHTTP.send(HttpChannelOverHTTP.java:79)\r\n\tat org.eclipse.jetty.client.HttpConnection.send(HttpConnection.java:199)\r\n\tat org.eclipse.jetty.client.http.HttpConnectionOverHTTP$Delegate.send(HttpConnectionOverHTTP.java:202)\r\n\tat org.eclipse.jetty.client.http.HttpConnectionOverHTTP.send(HttpConnectionOverHTTP.java:82)\r\n\tat org.eclipse.jetty.client.http.HttpDestinationOverHTTP.send(HttpDestinationOverHTTP.java:37)\r\n\tat org.eclipse.jetty.client.http.HttpDestinationOverHTTP.send(HttpDestinationOverHTTP.java:27)\r\n\tat org.eclipse.jetty.client.PoolingHttpDestination.process(PoolingHttpDestination.java:162)\r\n\tat org.eclipse.jetty.client.PoolingHttpDestination.process(PoolingHttpDestination.java:113)\r\n\tat org.eclipse.jetty.client.PoolingHttpDestination.send(PoolingHttpDestination.java:97)\r\n\tat org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:199)\r\n\tat org.eclipse.jetty.client.HttpClient.send(HttpClient.java:538)\r\n\tat org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:694)\r\n\tat org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:678)\r\n\tat io.airlift.http.client.jetty.JettyHttpClient.executeAsync(JettyHttpClient.java:363)\r\n\tat com.facebook.presto.client.StatementClient.close(StatementClient.java:354)\r\n\tat com.facebook.presto.cli.Query.renderResults(Query.java:183)\r\n\tat com.facebook.presto.cli.Query.renderQueryOutput(Query.java:129)\r\n\tat com.facebook.presto.cli.Query.renderOutput(Query.java:97)\r\n\tat com.facebook.presto.cli.Console.process(Console.java:285)\r\n\tat com.facebook.presto.cli.Console.runConsole(Console.java:226)\r\n\tat com.facebook.presto.cli.Console.run(Console.java:132)\r\n\tat com.facebook.presto.cli.Presto.main(Presto.java:32)\r\nCaused by: java.nio.channels.ClosedByInterruptException\r\n\tat java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)\r\n\tat sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:511)\r\n\tat org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:177)\r\n\t... 30 more\r\n```"},"comment":{"url":"https://api.github.com/repos/prestodb/presto/issues/comments/209029254","html_url":"https://github.com/prestodb/presto/pull/4720#issuecomment-209029254","issue_url":"https://api.github.com/repos/prestodb/presto/issues/4720","id":209029254,"user":{"login":"nezihyigitbasi","id":1223839,"avatar_url":"https://avatars.githubusercontent.com/u/1223839?v=3","gravatar_id":"","url":"https://api.github.com/users/nezihyigitbasi","html_url":"https://github.com/nezihyigitbasi","followers_url":"https://api.github.com/users/nezihyigitbasi/followers","following_url":"https://api.github.com/users/nezihyigitbasi/following{/other_user}","gists_url":"https://api.github.com/users/nezihyigitbasi/gists{/gist_id}","starred_url":"https://api.github.com/users/nezihyigitbasi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nezihyigitbasi/subscriptions","organizations_url":"https://api.github.com/users/nezihyigitbasi/orgs","repos_url":"https://api.github.com/users/nezihyigitbasi/repos","events_url":"https://api.github.com/users/nezihyigitbasi/events{/privacy}","received_events_url":"https://api.github.com/users/nezihyigitbasi/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T17:55:55Z","updated_at":"2016-04-12T17:55:55Z","body":"@electrum Updated. I think the `userAbortedQuery` variable is also not correctly maintained. Even when the pager process completes successfully it was set. "}}