-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
OutputStreamContentProvider blocks forever during an HTTP2 upload after idle timeout is reached #7951
Comments
Don't think the |
Agree, the bearer does not matter. |
I don't know if it helps, but if I replace the try (InputStream is = Files.newInputStream(path);
InputStreamContentProvider content = new InputStreamContentProvider(is)) {
...
} |
I managed to make it work with OutputStreamContentProvider content = new OutputStreamContentProvider();
...
InputStreamResponseListener listener = new InputStreamResponseListener() {
public void onComplete(Result result) {
super.onComplete(result);
if (result.isSucceeded()) {
content.succeeded();
} else {
content.failed(result.getFailure());
}
}
};
}; |
This still smells like a bug on our side. |
This issue has been automatically marked as stale because it has been a |
This issue has been automatically marked as stale because it has been a |
@gsavin the problem is that you are not closing the You need to do this: OutputStream output = ...
...
LOG.info("WRITING");
try (InputStream is = Files.newInputStream(Paths.get("/some/file"))) {
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer)) != -1) {
output.write(buffer, 0, len);
}
}
// Signal that there is no more content to write.
output.close(); Your code's Please remove the "hack" of calling |
…TP2 upload after idle timeout is reached. Improved javadocs. Signed-off-by: Simone Bordet <[email protected]>
Jetty version(s)
Tested on:
9.4.31.v20200723
9.4.36.v20210114
9.4.46.v20220331
Java version/vendor
(use: java -version)
OS type/version
Centos 8.5
Description
I am using an HTTP2 client to upload large file. During upload, if the network link is cut (I am unplugging it), the
DeferredContentProvider
I am using (throughOutputStreamContentProvider
) is blocked on theflush()
operation following thewrite()
. Once idle timeout is reached, the content provider is not notified and stay blocked forever.I tried to dig into Jetty code, but I am not sure what to look for. It looks like when the
HttpConnectionOverHTTP2#abort
is called, theHttpExchange
object associated to the channel is null, soRequest.abort
is not called. It has been set to null by thedissociate
that happened a bit earlier (we can see in the stack that the disassociate has been caused by the idle timeout being reached):Any clue about how to fix this?
Thanks.
How to reproduce?
Here is a dirty MRE leading to this error if network is unplugged during writing:
The text was updated successfully, but these errors were encountered: