{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/34059676","id":34059676,"diff_hunk":"@@ -586,6 +597,87 @@ public void sendsTimeoutHeader() {\n     Assert.assertEquals(572000L, (long) requestHeadersCapture.get().get(ChannelImpl.TIMEOUT_KEY));\n   }\n \n+  @Test\n+  public void deadlineNotExceeded() {\n+    serverDelayMillis.set(0);\n+    // warm up the channel and JVM\n+    blockingStub.emptyCall(Empty.getDefaultInstance());\n+    TestServiceGrpc.newBlockingStub(channel)\n+        .configureNewStub()\n+        .setTimeout(10, TimeUnit.MILLISECONDS)\n+        .build().emptyCall(Empty.getDefaultInstance());\n+  }\n+\n+  @Test(timeout = 10000)\n+  public void deadlineExceeded() {\n+    serverDelayMillis.set(20);\n+    // warm up the channel and JVM\n+    blockingStub.emptyCall(Empty.getDefaultInstance());\n+    TestServiceGrpc.TestServiceBlockingStub stub = TestServiceGrpc.newBlockingStub(channel)\n+        .configureNewStub()\n+        .setTimeout(10, TimeUnit.MILLISECONDS)\n+        .build();\n+    try {\n+      stub.emptyCall(Empty.getDefaultInstance());\n+      fail(\"Expected deadline to be exceeded\");\n+    } catch (Throwable t) {\n+      assertEquals(Status.DEADLINE_EXCEEDED, Status.fromThrowable(t));\n+    }\n+  }\n+\n+  @Test(timeout = 10000)\n+  public void deadlineExceededServerStreaming() throws Exception {\n+    serverDelayMillis.set(10); // applied to every message\n+    // warm up the channel and JVM\n+    blockingStub.emptyCall(Empty.getDefaultInstance());\n+    TestServiceGrpc.TestService asyncStub = TestServiceGrpc.newStub(channel)\n+        .configureNewStub()\n+        .setTimeout(30, TimeUnit.MILLISECONDS)\n+        .build();\n+    StreamingOutputCallRequest request = StreamingOutputCallRequest.newBuilder()\n+        .setResponseType(PayloadType.COMPRESSABLE)\n+        .addResponseParameters(ResponseParameters.newBuilder()\n+            .setSize(1))\n+        .addResponseParameters(ResponseParameters.newBuilder()\n+            .setSize(1))\n+        .addResponseParameters(ResponseParameters.newBuilder()\n+            .setSize(1))\n+        .addResponseParameters(ResponseParameters.newBuilder()\n+            .setSize(1))\n+        .build();\n+    StreamRecorder<StreamingOutputCallResponse> recorder = StreamRecorder.create();\n+    asyncStub.streamingOutputCall(request, recorder);\n+    recorder.awaitCompletion();\n+    assertEquals(Status.DEADLINE_EXCEEDED, Status.fromThrowable(recorder.getError()));\n+    assertNotEquals(0, recorder.getValues().size());\n+  }\n+\n+  @Test(timeout = 10000)\n+  public void deadlineAppliedAfterClientInterceptors() throws Exception {","path":"interop-testing/src/main/java/io/grpc/testing/integration/AbstractTransportTest.java","position":125,"original_position":125,"commit_id":"5f8988029c81f46a2dc4804fdd72e40c7889f4ee","original_commit_id":"5f8988029c81f46a2dc4804fdd72e40c7889f4ee","user":{"login":"ejona86","id":2811396,"avatar_url":"https://avatars.githubusercontent.com/u/2811396?v=3","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},"body":"This test we can probably get rid of. In #574 we are swapping to using a deadline, so this test would no longer make sense. #574 is pretty far along, and I expect will be merged today or tomorrow (and yes, it will cause some conflicts with this one, or vise versa).","created_at":"2015-07-07T16:26:03Z","updated_at":"2015-07-07T16:26:03Z","html_url":"https://github.com/grpc/grpc-java/pull/576#discussion_r34059676","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/576","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/34059676"},"html":{"href":"https://github.com/grpc/grpc-java/pull/576#discussion_r34059676"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/576"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/576","id":38717123,"html_url":"https://github.com/grpc/grpc-java/pull/576","diff_url":"https://github.com/grpc/grpc-java/pull/576.diff","patch_url":"https://github.com/grpc/grpc-java/pull/576.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/576","number":576,"state":"open","locked":false,"title":"Apply client side timeouts","user":{"login":"johnbcoughlin","id":2209490,"avatar_url":"https://avatars.githubusercontent.com/u/2209490?v=3","gravatar_id":"","url":"https://api.github.com/users/johnbcoughlin","html_url":"https://github.com/johnbcoughlin","followers_url":"https://api.github.com/users/johnbcoughlin/followers","following_url":"https://api.github.com/users/johnbcoughlin/following{/other_user}","gists_url":"https://api.github.com/users/johnbcoughlin/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbcoughlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbcoughlin/subscriptions","organizations_url":"https://api.github.com/users/johnbcoughlin/orgs","repos_url":"https://api.github.com/users/johnbcoughlin/repos","events_url":"https://api.github.com/users/johnbcoughlin/events{/privacy}","received_events_url":"https://api.github.com/users/johnbcoughlin/received_events","type":"User","site_admin":false},"body":"@ejona86 opening this as a work in progress to get some advice.\r\n\r\nA couple of questions:\r\n\r\n- It seems hard to satisfy the contract for `ClientStreamListener.close`, that it always be the last method called on the listener, if we have a stream racing with a deadline to call it. One solution is to have the listener impl provide its own idempotence via a CAS or some other mechanism, but that obviously doesn't satisfy the public contract on the interface. It's not clear to me how important that is.\r\n- The first call on a Netty channel takes at least 120 millis, due (I think) to `obtainActiveTransport()`. Reading briefly into that code though, I don't see any obvious expensive asynchronous operations. Thoughts on this? It would be bad to always time out the first call on a channel.","created_at":"2015-06-27T23:15:20Z","updated_at":"2015-07-07T16:26:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fd803b65cc1f16f561c9a1cdca7e98ad1c7ec41","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/576/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/576/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/576/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/5f8988029c81f46a2dc4804fdd72e40c7889f4ee","head":{"label":"johnbcoughlin:johnbcoughlin-deadline-timer","ref":"johnbcoughlin-deadline-timer","sha":"5f8988029c81f46a2dc4804fdd72e40c7889f4ee","user":{"login":"johnbcoughlin","id":2209490,"avatar_url":"https://avatars.githubusercontent.com/u/2209490?v=3","gravatar_id":"","url":"https://api.github.com/users/johnbcoughlin","html_url":"https://github.com/johnbcoughlin","followers_url":"https://api.github.com/users/johnbcoughlin/followers","following_url":"https://api.github.com/users/johnbcoughlin/following{/other_user}","gists_url":"https://api.github.com/users/johnbcoughlin/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbcoughlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbcoughlin/subscriptions","organizations_url":"https://api.github.com/users/johnbcoughlin/orgs","repos_url":"https://api.github.com/users/johnbcoughlin/repos","events_url":"https://api.github.com/users/johnbcoughlin/events{/privacy}","received_events_url":"https://api.github.com/users/johnbcoughlin/received_events","type":"User","site_admin":false},"repo":{"id":37389084,"name":"grpc-java","full_name":"johnbcoughlin/grpc-java","owner":{"login":"johnbcoughlin","id":2209490,"avatar_url":"https://avatars.githubusercontent.com/u/2209490?v=3","gravatar_id":"","url":"https://api.github.com/users/johnbcoughlin","html_url":"https://github.com/johnbcoughlin","followers_url":"https://api.github.com/users/johnbcoughlin/followers","following_url":"https://api.github.com/users/johnbcoughlin/following{/other_user}","gists_url":"https://api.github.com/users/johnbcoughlin/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbcoughlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbcoughlin/subscriptions","organizations_url":"https://api.github.com/users/johnbcoughlin/orgs","repos_url":"https://api.github.com/users/johnbcoughlin/repos","events_url":"https://api.github.com/users/johnbcoughlin/events{/privacy}","received_events_url":"https://api.github.com/users/johnbcoughlin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/johnbcoughlin/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/johnbcoughlin/grpc-java","forks_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/forks","keys_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/teams","hooks_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/events","assignees_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/tags","blobs_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/languages","stargazers_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/subscription","commits_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/merges","archive_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/downloads","issues_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/johnbcoughlin/grpc-java/releases{/id}","created_at":"2015-06-13T21:47:56Z","updated_at":"2015-06-13T21:47:57Z","pushed_at":"2015-07-07T16:04:49Z","git_url":"git://github.com/johnbcoughlin/grpc-java.git","ssh_url":"git@github.com:johnbcoughlin/grpc-java.git","clone_url":"https://github.com/johnbcoughlin/grpc-java.git","svn_url":"https://github.com/johnbcoughlin/grpc-java","homepage":"","size":2632,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"30455fd2f49404d697deff6c76e11110893d8c6c","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729926,"name":"grpc-java","full_name":"grpc/grpc-java","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":false,"url":"https://api.github.com/repos/grpc/grpc-java","forks_url":"https://api.github.com/repos/grpc/grpc-java/forks","keys_url":"https://api.github.com/repos/grpc/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc-java/teams","hooks_url":"https://api.github.com/repos/grpc/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc-java/events","assignees_url":"https://api.github.com/repos/grpc/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc-java/tags","blobs_url":"https://api.github.com/repos/grpc/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc-java/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc-java/subscription","commits_url":"https://api.github.com/repos/grpc/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc-java/merges","archive_url":"https://api.github.com/repos/grpc/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc-java/downloads","issues_url":"https://api.github.com/repos/grpc/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc-java/releases{/id}","created_at":"2014-12-08T19:00:00Z","updated_at":"2015-07-07T13:27:39Z","pushed_at":"2015-07-07T16:04:49Z","git_url":"git://github.com/grpc/grpc-java.git","ssh_url":"git@github.com:grpc/grpc-java.git","clone_url":"https://github.com/grpc/grpc-java.git","svn_url":"https://github.com/grpc/grpc-java","homepage":"","size":19014,"stargazers_count":766,"watchers_count":766,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":172,"mirror_url":null,"open_issues_count":96,"forks":172,"open_issues":96,"watchers":766,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/576"},"html":{"href":"https://github.com/grpc/grpc-java/pull/576"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/576"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/576/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/576/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/576/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/5f8988029c81f46a2dc4804fdd72e40c7889f4ee"}}}}