-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Add onRequest() hook for propagating request from downstream #34388
Add onRequest() hook for propagating request from downstream #34388
Conversation
Signed-off-by: Gang Cheng <[email protected]>
I have the same analysis than @bclozel in #34178 (comment), I think this change, while probably fixing the issue, is going to over-request. We need to explore and understand what triggers this more in detail before crafting a fix. As a consequence, I will close this PR unmerged in favor of #34178. |
Reopening this PR based on #34178 (comment). |
Reopening to refine in order to prevent over-requesting based on a discussion with @chemicL. |
@bclozel @chemicL @rstoyanchev I tried to add a private void requestBuffer() {
if (upstream() != null &&
!this.sink.isCancelled() &&
this.sink.requestedFromDownstream() > 0 &&
this.requestOutstanding.compareAndSet(false, true)) {
request(1);
}
} To: private void requestBuffer() {
if (upstream() != null && !this.sink.isCancelled() && this.requestOutstanding.compareAndSet(false, true)) {
if (this.sink.requestedFromDownstream() > 0 || this.waitingForRequest.compareAndSet(true, false)) {
request(1);
}
else {
System.out.println("Waiting for request");
this.waitingForRequest.set(true);
}
}
} After 20-30 tries, I saw the I am wondering if there is really over-requesting, especially with the |
I think the above conditions won't match in case of resumption. The problematic scenario seems to be the following:
Usually the downstream requests a higher number so the initial value is not 1 and progress can be made for some time. I think the |
No problem @chemicL, thanks a lot for taking the time to share your detailed feedback, I will close the PR and keep what is committed then. |
Try to fix #34178
After reproducing and debugging the issue, I found the
onRequest()
hook is missing. After the fix, theMultipartParser
is functioning properly, and the upload hang issue has not occurred again. I tested this locally.