Skip to content
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

PemReader #10974

Closed
violetgo opened this issue Jan 29, 2021 · 4 comments
Closed

PemReader #10974

violetgo opened this issue Jan 29, 2021 · 4 comments
Milestone

Comments

@violetgo
Copy link

Expected behavior

hi , I have a few confuse. it seem PemRead.java have not close InputStream at readPrivateKey and readContent method ?
https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/PemReader.java

why neety don't close it ?
Are they not make open file leak?

if i use SslContextBuilder for build ssl SslContextBuilder forServer(InputStream keyCertChainInputStream, InputStream keyInputStream)
the method call stack seems are not close InputStream yet ?
it is mean I need close it by myself?

Actual behavior

it seems i got file open leak?

image

image

Steps to reproduce

N/A

Minimal yet complete reproducer code (or URL to code)

N/A

Netty version

netty-all-4.1.25.Final.jar

JVM version (e.g. java -version)

java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)

OS version (e.g. uname -a)

uname -a
Linux ip-10-0-4-111.ec2.internal 3.10.0-862.3.2.el7.x86_64 #1 SMP Mon May 21 23:36:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

@normanmaurer
Copy link
Member

Yes at the moment we expect you to call close... That said I can't think of a good reason why we shouldn't call close here one we consumed the stream. I will open a PR to change this

@normanmaurer normanmaurer added this to the 4.1.59.Final milestone Jan 29, 2021
normanmaurer added a commit that referenced this issue Jan 29, 2021
…te key

Motivation:

At the moment we not close the streams once we are done reading which could lead to ta fd leak if the user not explicit close these. We should just close these once we consumed the streams

Modifications:

- Always close the streams
- Add unit tests

Result:

Fixes #10974
@normanmaurer
Copy link
Member

Should be fixed by #10976

normanmaurer added a commit that referenced this issue Jan 31, 2021
…as build

Motivation:

It was not 100% clear whom is responsible calling close() on the InputStream.

Modifications:

Clarify javadocs.

Result:

Related to #10974
@normanmaurer
Copy link
Member

Clarified javadocs in #10983

@violetgo
Copy link
Author

violetgo commented Feb 1, 2021

Clarified javadocs in #10983

/lgtm
and I found this bug by use dubbo , and I will report this bug to dubbo too, thanks~

@violetgo violetgo closed this as completed Feb 1, 2021
normanmaurer added a commit that referenced this issue Feb 1, 2021
…#10983)


Motivation:

It was not 100% clear who is responsible calling close() on the InputStream.

Modifications:

Clarify javadocs.

Result:

Related to #10974

Co-authored-by: Chris Vest <christianvest_hansen@apple.com>
normanmaurer added a commit that referenced this issue Feb 1, 2021
…#10983)


Motivation:

It was not 100% clear who is responsible calling close() on the InputStream.

Modifications:

Clarify javadocs.

Result:

Related to #10974

Co-authored-by: Chris Vest <christianvest_hansen@apple.com>
raidyue pushed a commit to raidyue/netty that referenced this issue Jul 8, 2022
…netty#10983)


Motivation:

It was not 100% clear who is responsible calling close() on the InputStream.

Modifications:

Clarify javadocs.

Result:

Related to netty#10974

Co-authored-by: Chris Vest <christianvest_hansen@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants