I use intellij and and I am facing an issue while running tests in PerRequestTimeoutTest . If I run all the tests in this file all of them pass but when I try to run an individual test it fails.
This is the scenarios -
1) Ran PerRequestTimeoutTest#testGlobalRequestTimeout
I looked into logs and found this
2017-04-26 11:38:48,079 [pool-1-thread-1] WARN io.netty.util.HashedWheelTimer - An exception was thrown by TimerTask.
java.lang.NullPointerException: null
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.appendRemoteAddress(TimeoutTimerTask.java:59)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:48)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:661)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:736)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:464)
at java.lang.Thread.run(Thread.java:745)
This implies TimeoutTimerTask ran before setResolvedRemoteAddress was called.
2 ) Ran all tests from PerRequestTimeoutTest - found this in logs for testGlobalRequestTimeout
2017-04-26 11:45:19,727 [pool-3-thread-1] DEBUG org.asynchttpclient.netty.timeout.TimeoutTimerTask - Request timeout to localhost/127.0.0.1:50766 after 100 ms for NettyResponseFuture{currentRetry=0,
isDone=0,
isCancelled=0,
asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@5b61eb9d,
nettyRequest=org.asynchttpclient.netty.request.NettyRequest@7d5e0e87,
future=java.util.concurrent.CompletableFuture@238dde0b[Not completed, 1 dependents],
uri=http://localhost:50766/foo/test,
keepAlive=true,
redirectCount=0,
timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@2c779ae5,
inAuth=0,
statusReceived=0,
touch=1493187319526} after 204 ms
This implies setResolvedRemoteAddress was called before TimeoutTimerTask ran.
I am unable to figure out why would this happen. Is there some caching going on from previous requests which would help in resolving remoteAddress thus making tests pass when all of them ran ?
Also due to this issue there is a possibility that it might block the calling thread forever in the scenario TimeoutTimerTask failed and no response was received from server
I use intellij and and I am facing an issue while running tests in PerRequestTimeoutTest . If I run all the tests in this file all of them pass but when I try to run an individual test it fails.
This is the scenarios - 1) Ran PerRequestTimeoutTest#testGlobalRequestTimeout I looked into logs and found this 2017-04-26 11:38:48,079 [pool-1-thread-1] WARN io.netty.util.HashedWheelTimer - An exception was thrown by TimerTask. java.lang.NullPointerException: null at org.asynchttpclient.netty.timeout.TimeoutTimerTask.appendRemoteAddress(TimeoutTimerTask.java:59) at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:48) at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:661) at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:736) at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:464) at java.lang.Thread.run(Thread.java:745)
This implies TimeoutTimerTask ran before setResolvedRemoteAddress was called.
2 ) Ran all tests from PerRequestTimeoutTest - found this in logs for testGlobalRequestTimeout 2017-04-26 11:45:19,727 [pool-3-thread-1] DEBUG org.asynchttpclient.netty.timeout.TimeoutTimerTask - Request timeout to localhost/127.0.0.1:50766 after 100 ms for NettyResponseFuture{currentRetry=0, isDone=0, isCancelled=0, asyncHandler=org.asynchttpclient.AsyncCompletionHandlerBase@5b61eb9d, nettyRequest=org.asynchttpclient.netty.request.NettyRequest@7d5e0e87, future=java.util.concurrent.CompletableFuture@238dde0b[Not completed, 1 dependents], uri=http://localhost:50766/foo/test, keepAlive=true, redirectCount=0, timeoutsHolder=org.asynchttpclient.netty.timeout.TimeoutsHolder@2c779ae5, inAuth=0, statusReceived=0, touch=1493187319526} after 204 ms
This implies setResolvedRemoteAddress was called before TimeoutTimerTask ran.
I am unable to figure out why would this happen. Is there some caching going on from previous requests which would help in resolving remoteAddress thus making tests pass when all of them ran ?
Also due to this issue there is a possibility that it might block the calling thread forever in the scenario TimeoutTimerTask failed and no response was received from server