Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle a leak when thrift requests are aborted early (#5535)
Motivation: We received a report where thrift was leaking pooled byte buffers. We use pooled byte buffers to create the thrift request in `THttpClientDelegate` assuming that it will be released when sent on the wire for normal cases. https://github.com/line/armeria/blob/7f302505a05d24e7704bcffc43fab6337344cb2c/thrift/thrift0.13/src/main/java/com/linecorp/armeria/internal/client/thrift/THttpClientDelegate.java#L134 However, if any requests don't have a chance to reach the wire, they will leak the byte buffer. I believe it is reasonable to assume that requests not decoded properly should be cleaned up. Hence, I propose we do an extra `req.abort` inside `handlePreDecodeException`. Modifications: - Modify `handlePreDecodeException` to accept an additional `HttpRequest` parameter - Abort the request with the exception if exists Result: - #5481 <!-- Visit this URL to learn more about how to write a pull request description: https://armeria.dev/community/developer-guide#how-to-write-pull-request-description -->
- Loading branch information