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

Fix incorrect trace output upon file closing #38

Closed
wants to merge 1 commit into from

Conversation

blindpirate
Copy link

Previously when a file close callback is invoked, the dumped trace is not
the closing stacktrace, but the opening stacktrace. This PR fixes this issue
by creating a new FileRecord instance.

Previously when a file close callback is invoked, the dumped trace is not
the closing stacktrace, but the opening stacktrace. This PR fixes this issue
by creating a new FileRecord instance.
@kohsuke
Copy link
Member

kohsuke commented Oct 29, 2018

Interesting. For me, the original was the expected behaviour. Maybe we need to print both open & close.

@blindpirate
Copy link
Author

With the "expected" behavior, it's difficult to track when a file is closed - the "open" stacktrace is printed at the "close" point. I strongly recommend changing to this PR's behaviour because it's really helpful in my practice.

@kohsuke
Copy link
Member

kohsuke commented Nov 1, 2018

Thanks, please help me understand your practice a bit more.

@blindpirate
Copy link
Author

My case was that in a large application there're some file handler leaks. I applied this library to my application and printed all open/close log to a file. When analyzing the log file, I noticed that I couldn't find out where the files were closed - for example, you see a file opened twice but only closed once, and the close() code can be invoked in two (or more) places, without closing stacktrace I can't understand where it's closed and where it's not closed.

Hope this makes sense.

@kohsuke
Copy link
Member

kohsuke commented Nov 2, 2018

That makes total sense, thank you!!

@MarkEWaite
Copy link
Contributor

Closing in favor of #132

@MarkEWaite MarkEWaite closed this May 29, 2023
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 this pull request may close these issues.

3 participants