Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix akka HTTP client POST request racing conditions #3251

Closed
t83714 opened this issue Oct 20, 2021 · 1 comment
Closed

Fix akka HTTP client POST request racing conditions #3251

t83714 opened this issue Oct 20, 2021 · 1 comment
Assignees
Milestone

Comments

@t83714
Copy link
Contributor

t83714 commented Oct 20, 2021

Fix akka HTTP client POST request racing conditions

Although it's rare, users might see the following error, when registry request send POST requests to OPA for auth decision:

akka.http.impl.engine.client.OutgoingConnectionBlueprint$UnexpectedConnectionClosureException: The http server closed the connection unexpectedly before delivering responses for 1 outstanding requests 

According to this issue, Akka will try to reuse the same connection for requests until server sends "Connection: close" header.

There might be a racing condition where akka http client sends out request when server's "Connection: close" header has left the server but still on its way to the client.

When that happens, if it's a HTTP GET request, akka client will auto retry it.

However, for POST requests, akka won't retry them (as POST requests can't be considered as idempotent) and akka.http.impl.engine.client.OutgoingConnectionBlueprint$UnexpectedConnectionClosureException error will be thrown.

This error will not happen very often but does create troubles for test cases in pipelines.

Solution

Manually retry POST request

@t83714 t83714 added this to the Next milestone Oct 20, 2021
@t83714 t83714 self-assigned this Oct 20, 2021
t83714 added a commit that referenced this issue Oct 21, 2021
#3251 Fixed akka HTTP client POST request racing conditions
@t83714
Copy link
Contributor Author

t83714 commented Oct 21, 2021

closed via PR: #3252

@t83714 t83714 closed this as completed Oct 21, 2021
t83714 added a commit that referenced this issue Nov 14, 2021
t83714 added a commit that referenced this issue Nov 14, 2021
Cherry-pick PR for issue #3251 from next branch into v1.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant