Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

LzmaInputStream#close() doesn't close the wrapped InputStream #14

Closed
Scottmitch opened this issue Nov 16, 2016 · 2 comments
Closed

LzmaInputStream#close() doesn't close the wrapped InputStream #14

Scottmitch opened this issue Nov 16, 2016 · 2 comments

Comments

@Scottmitch
Copy link

Scottmitch commented Nov 16, 2016

LzmaInputStream wraps an InputStream but does not manage the lifetime of that InputStream [1]. this is generally common practice (e.g. BufferedInputStream, GZIPInputStream, etc...), and may lead to resource leaks if the underlying stream is not managed externally to the LzmaInputStream. Is there a reason why the lifetime of the wrapped stream is not managed?

This may actually be the responsibility of CoderInputStream [2], but I figured I would start here.

[1] https://github.com/jponge/lzma-java/blob/master/src/main/java/lzma/streams/LzmaInputStream.java
[2] https://github.com/cstamas/streams/blob/master/src/main/java/org/cservenak/streams/CoderInputStream.java#L80

@Scottmitch
Copy link
Author

related to cstamas/streams#1

Scottmitch added a commit to Scottmitch/netty that referenced this issue Nov 16, 2016
Motivation:
c1932a8 made an assumption that the LzmaInputStream which wraps a ByteBufInputStream would delegate the close operation to the wrapped stream. This assumption is not true and thus we still had a leak. An issue has been logged with our LZMA dependency jponge/lzma-java#14.

Modifications:
- Force a close on the wrapped stream

Result:
No more leak.
Scottmitch added a commit to netty/netty that referenced this issue Nov 16, 2016
Motivation:
c1932a8 made an assumption that the LzmaInputStream which wraps a ByteBufInputStream would delegate the close operation to the wrapped stream. This assumption is not true and thus we still had a leak. An issue has been logged with our LZMA dependency jponge/lzma-java#14.

Modifications:
- Force a close on the wrapped stream

Result:
No more leak.
@jponge jponge closed this as completed Nov 16, 2016
@jponge
Copy link
Owner

jponge commented Nov 16, 2016 via email

liuzhengyang pushed a commit to liuzhengyang/netty that referenced this issue Sep 10, 2017
Motivation:
c1932a8 made an assumption that the LzmaInputStream which wraps a ByteBufInputStream would delegate the close operation to the wrapped stream. This assumption is not true and thus we still had a leak. An issue has been logged with our LZMA dependency jponge/lzma-java#14.

Modifications:
- Force a close on the wrapped stream

Result:
No more leak.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants