apple / servicetalk

A networking framework that evolves with your application
https://docs.servicetalk.io
Apache License 2.0
919 stars 181 forks source link

Flaky test: io.servicetalk.http.router.jersey.AsynchronousResourceTest.getVoidCompletion #1147

Open idelpivnitskiy opened 4 years ago

idelpivnitskiy commented 4 years ago

Jersey inconsistently returns 200 or 204 when an endpoint returns CompletionStage. The status code depends on the state of CompletionStage. If it is already compete before JAX-RS method returns, then Jersey returns 204. If not, Jersey returns 200.

io.servicetalk.http.router.jersey.AsynchronousResourceTest.getVoidCompletion[ASYNC_STREAMING server-no-offloads = false]

Error Message
java.lang.AssertionError: 
Expected: is <200 OK>
     but: was <204 No Content>
Stacktrace
java.lang.AssertionError: 
Expected: is <200 OK>
     but: was <204 No Content>
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    at org.junit.Assert.assertThat(Assert.java:964)
    at org.junit.Assert.assertThat(Assert.java:930)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.sendAndAssertStatus(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:374)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:334)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:320)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:299)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:280)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.sendAndAssertNoResponse(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:266)
    at io.servicetalk.http.router.jersey.AsynchronousResourceTest.lambda$getVoidCompletion$20(AsynchronousResourceTest.java:290)
    at io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest.runTwiceToEnsureEndpointCache(AbstractNonParameterizedJerseyStreamingHttpServiceTest.java:393)
    at io.servicetalk.http.router.jersey.AsynchronousResourceTest.getVoidCompletion(AsynchronousResourceTest.java:287)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.mockito.internal.junit.JUnitRule$1.evaluateSafely(JUnitRule.java:57)
    at org.mockito.internal.junit.JUnitRule$1.evaluate(JUnitRule.java:48)
    at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:258)
    at io.servicetalk.concurrent.internal.ServiceTalkTestTimeout$TimeoutStatement$CallableStatement.call(ServiceTalkTestTimeout.java:171)
    at io.servicetalk.concurrent.internal.ServiceTalkTestTimeout$TimeoutStatement$CallableStatement.call(ServiceTalkTestTimeout.java:163)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)
Standard Output
2020-09-09 19:39:05,947      servicetalk-executor-11-4 [ERROR] NettyHttpServer$NettyHttpServerConnection - Internal server error service=io.servicetalk.http.api.ServiceToStreamingService@408668b6 connection=[id: 0xf4702cf1, L:/127.0.0.1:36952 - R:/127.0.0.1:50792]
io.servicetalk.concurrent.internal.DeliberateException: Deliberate Exception
2020-09-09 19:39:05,983      servicetalk-executor-11-3 [ERROR] NettyHttpServer$NettyHttpServerConnection - Internal server error service=io.servicetalk.http.a
...[truncated 159271 chars]...
c connection=[id: 0x88370748, L:/127.0.0.1:34743 - R:/127.0.0.1:46630]
io.servicetalk.concurrent.internal.DeliberateException: Deliberate Exception
2020-09-09 19:40:55,681      servicetalk-executor-11-4 [ERROR] NettyHttpServer$NettyHttpServerConnection - Internal server error service=io.servicetalk.http.api.BlockingStreamingToStreamingService@6d1f6e7c connection=[id: 0x88370748, L:/127.0.0.1:34743 - R:/127.0.0.1:46630]
io.servicetalk.concurrent.internal.DeliberateException: Deliberate Exception
idelpivnitskiy commented 2 years ago

https://github.com/apple/servicetalk/actions/runs/3341170597/jobs/5532204378

AsynchronousResourceTest.BLOCKING_STREAMING server-no-offloads = false
java.lang.AssertionError: 
Expected: is <200 OK>
     but: was <204 No Content>
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.sendAndAssertStatus(AbstractJerseyStreamingHttpServiceTest.java:372)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractJerseyStreamingHttpServiceTest.java:330)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractJerseyStreamingHttpServiceTest.java:316)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractJerseyStreamingHttpServiceTest.java:295)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.sendAndAssertResponse(AbstractJerseyStreamingHttpServiceTest.java:276)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.sendAndAssertNoResponse(AbstractJerseyStreamingHttpServiceTest.java:262)
    at io.servicetalk.http.router.jersey.AsynchronousResourceTest.lambda$getVoidCompletion$20(AsynchronousResourceTest.java:331)
    at io.servicetalk.http.router.jersey.AbstractJerseyStreamingHttpServiceTest.runTwiceToEnsureEndpointCache(AbstractJerseyStreamingHttpServiceTest.java:391)
    at io.servicetalk.http.router.jersey.AsynchronousResourceTest.getVoidCompletion(AsynchronousResourceTest.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)