Skip to content

[REST] Rest client should catch NoHttpResponse Exception and retry#4334

Closed
zwangsheng wants to merge 2 commits intoapache:masterfrom
zwangsheng:rest_client/retry_with_no_http_response
Closed

[REST] Rest client should catch NoHttpResponse Exception and retry#4334
zwangsheng wants to merge 2 commits intoapache:masterfrom
zwangsheng:rest_client/retry_with_no_http_response

Conversation

@zwangsheng
Copy link
Contributor

Why are the changes needed?

NoHttpResponseException

In some circumstances, usually when under heavy load, the web server may be able to receive requests but unable to process them. A lack of sufficient resources like worker threads is a good example. This may cause the server to drop the connection to the client without giving any response. HttpClient throws NoHttpResponseException when it encounters such a condition. In most cases it is safe to retry a method that failed with NoHttpResponseException.

In case of Kyuubi Server is overloaded and does not have enough resources to allocate threads to handle the corresponding request, the request will be dropped and no response will be returned, Kyuubi Rest Client should catch this exception and retry.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before make a pull request

@zwangsheng
Copy link
Contributor Author

@zwangsheng zwangsheng changed the title [REST] Rest Client should catch NoHttpResponse Exception and retry [REST] Rest client should catch NoHttpResponse Exception and retry Feb 15, 2023
@pan3793 pan3793 added this to the v1.6.2 milestone Feb 15, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #4334 (d526e4a) into master (536944c) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #4334      +/-   ##
============================================
- Coverage     53.58%   53.56%   -0.02%     
  Complexity       13       13              
============================================
  Files           562      562              
  Lines         30704    30704              
  Branches       4142     4142              
============================================
- Hits          16452    16446       -6     
- Misses        12707    12714       +7     
+ Partials       1545     1544       -1     
Impacted Files Coverage Δ
...main/java/org/apache/kyuubi/client/RestClient.java 85.71% <100.00%> (ø)
...apache/kyuubi/engine/JpsApplicationOperation.scala 77.41% <0.00%> (-3.23%) ⬇️
.../apache/kyuubi/server/api/v1/BatchesResource.scala 70.09% <0.00%> (-2.81%) ⬇️
...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala 79.01% <0.00%> (+0.61%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pan3793 pan3793 closed this in a17ccdf Feb 15, 2023
pan3793 pushed a commit that referenced this pull request Feb 15, 2023
…ion` and retry

### _Why are the changes needed?_

[NoHttpResponseException](https://hc.apache.org/httpclient-legacy/exception-handling.html)

> In some circumstances, usually when under heavy load, the web server may be able to receive requests but unable to process them. A lack of sufficient resources like worker threads is a good example. This may cause the server to drop the connection to the client without giving any response. HttpClient throws NoHttpResponseException when it encounters such a condition. In most cases it is safe to retry a method that failed with NoHttpResponseException.

In case of Kyuubi Server is overloaded and does not have enough resources to allocate threads to handle the corresponding request, the request will be dropped and no response will be returned, Kyuubi Rest Client should catch this exception and retry.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #4334 from zwangsheng/rest_client/retry_with_no_http_response.

Closes #4334

d526e4a [zwangsheng] Remove Unrelated Code
708f249 [zwangsheng] [REST] Retry should catch NoHttpResponse Exception and retry

Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit a17ccdf)
Signed-off-by: Cheng Pan <chengpan@apache.org>
pan3793 pushed a commit that referenced this pull request Feb 15, 2023
…ion` and retry

### _Why are the changes needed?_

[NoHttpResponseException](https://hc.apache.org/httpclient-legacy/exception-handling.html)

> In some circumstances, usually when under heavy load, the web server may be able to receive requests but unable to process them. A lack of sufficient resources like worker threads is a good example. This may cause the server to drop the connection to the client without giving any response. HttpClient throws NoHttpResponseException when it encounters such a condition. In most cases it is safe to retry a method that failed with NoHttpResponseException.

In case of Kyuubi Server is overloaded and does not have enough resources to allocate threads to handle the corresponding request, the request will be dropped and no response will be returned, Kyuubi Rest Client should catch this exception and retry.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #4334 from zwangsheng/rest_client/retry_with_no_http_response.

Closes #4334

d526e4a [zwangsheng] Remove Unrelated Code
708f249 [zwangsheng] [REST] Retry should catch NoHttpResponse Exception and retry

Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit a17ccdf)
Signed-off-by: Cheng Pan <chengpan@apache.org>
@pan3793
Copy link
Member

pan3793 commented Feb 15, 2023

Thanks, merged to master/1.7/1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants