-
Notifications
You must be signed in to change notification settings - Fork 156
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
NullPointerException when processing file without GC Events #359
Comments
Some further observations:
I understand that there is only so much that a library should do when it comes to handling unexpected input; the application using the library has to bear some of that responsibility. However, it seems problematic that invalid input can put the library into a state that hangs the JVM with a relatively simple use case. |
Agreed on all points. |
I would love to give a shot on this issue. |
Please go ahead! |
@Lmh-java, I will freely admit that this case isn't well covered as the assumption has always been that the log file presented has GC events in it. It's just not something that I see happening enough to care about it all that much but this doesn't mean that something shouldn't be done to cover this off. That said, here is some information that you may find useful. Setup if controlled by the diarization process. It looks for features in the file to build up a diary. This diary is used by GCToolKit when it is making certain decisions such as which parsers to instantiate. In pre-unified logs, it is used to report on flags used to created the log file. This was used to support an analytic that allowed us to guide the user to more useful JVM flag configurations. The diary process is setup to only look into the log file until it finds all that it needs to know or has looked 10k lines. The assumption being that the diarization should have found everything it needs to know by then. There are only a couple of edge cases where this assumption fails (such as a simple log for CMS in which no CMS cycles are present) but this is only for pre-unified logging so, generally works good enough for purpose. If there is enough information in the header then the diarizer will take the info from that and continue without looking deeper into the file. In this case parsers will be instantiated and the file will be streamed to them. If the file only contains headers and no GC events, then the only event emitted should be a JVMTermination event. However, this case isn't tested for or TBH, hasn't been thought through so anything that can be added here would be exceptionally useful. The only potential conflict here is that I've added support for genZ. Since this is a new feature I'll be adjusting diarization to be able to recognize and report on it. This should be checked in soon. |
Thanks for your detailed explanation on the diary process. I am relatively new to this project, and I am currently working on understanding the entire logic and coming up with a plan to address this issue. |
Describe the bug
A NullPointerException is thrown when processing a file that contains no GC events.
The JVM does not return after this NPE occurs. (Have to kill the process manually)
Callstack:
Sample File
To Reproduce
Steps to reproduce the behavior:
1: Using the sample application, attempt to analyze the file above.
mvnw.cmd exec:exec -DgcLogFile=sample.out
2: NPE above is thrown. Process hangs in place until terminated manually (Ctrl-C, or killing the JVM)
Expected behavior
File is successfully analyzed (even if no data is available) or a suitable error is returned.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: