-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fіx possible OOM in downloadFileAsStreamAsync #1467
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test inside TestTelegramClientIntegration to ensure it works as expected
@rubenlagus tests have been added. Now I see there are two possible usages of
The problem with the second usage is that we cannot get the By making the InputStream buffered, we can safely return a stream from completableFuture: InputStream is = client.downloadFileAsStreamAsync(...)..thenApply(is -> {
try {
return IOUtils.toBufferedInputStream(is);
} catch (IOException e) {
throw new RuntimeException(e);
}
}).get(); I've done this for I also though replacing Here are my observations for downloading 18_439_895 bytes:
|
I've been using the
-Xmx80M
JVM option since telegrambots 5.x. Recently I got an OOM error on telegrambots 8.0.0 after trying to download a 17.8M file:This PR fixes the issue