-
-
Notifications
You must be signed in to change notification settings - Fork 66
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 license report task in multi-project setups #191
Conversation
Currently running the license report task in multi-project setups is frequently causing the task to fail with "FWK005 parse may not be called while parsing." This is caused by the fact that LicenseReportTask.kt uses a static (companion) parser object. If parsing is already in progress for one project, a second report task on another project will fail if it tries to parse at the same time. This can be resolved by using an instance local parser variable.
Anyway to write a test for this? Seems so odd? Can you post the actual error on this thread? |
Can you at least a comment near this line of code to help explain the issue to prevent this in the future? |
Hi Jared, first I wanted to take the chance to say big thanks to you for this really useful plugin! Thank you for taking the time to respond. We use it on a multi-project gradle project, where it frequently exited with
We tracked it down to e.g. here https://github.com/JetBrains/jdk8u_jaxp/blob/ef214d85066b758a01f9949298b255b8ffd8ab19/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java#L765 (depends on the XML parser configuration, but to get the idea) and from the source you can see that it happens if the parser is currently parsing - this will happen if one task analyses a POM file while another license report task is already parsing another POM file. We frequently encountered it when running Writing a test is probably difficult, since the issue is behaving like a race condition and only happening sometimes. You could may be try to block the input stream in one I will happily add a comment, I just wanted to follow the existing style and thus skipped it. Do you want it to be verbose, or shall I add a short comment, may be even linking to this pull request? |
@fllink Thanks for the investigation. Can you just reference this PR in comment next to the code change, then we can merge this? |
Ensure the issue is not re-introduced in the future, since it would be difficult to cover this with an actual test due to the race condition nature of the issue.
Sure, thank you for the quick response! Im currently trying to reproduce the issue again on our CI with stack trace, and will add it here as soon as it is available. |
|
Stacktrace (I removed some lines from the gradle part):
|
Thanks! |
Currently running the license report task in multi-project setups is frequently causing the task to fail with "FWK005 parse may not be called while parsing." This is caused by the fact that LicenseReportTask.kt uses a static (companion) parser object. If parsing is already in progress for one project, a second report task on another project will fail if it tries to parse at the same time. This can be resolved by using an instance local parser variable.