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

Workaround for JDK 8 instability when reading config #4225

Merged
merged 1 commit into from
Nov 2, 2021

Conversation

davidburstromspotify
Copy link
Contributor

If Detekt is being executed in parallel in the same VM
but through different class loader instances, the configuration file
is sometimes not readable as a class loader might have closed
the zip stream. By telling the JVM to not use cached files readers,
the stability improves.

@codecov
Copy link

codecov bot commented Nov 2, 2021

Codecov Report

Merging #4225 (ef610e4) into main (891bf5d) will decrease coverage by 0.00%.
The diff coverage is 80.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #4225      +/-   ##
============================================
- Coverage     84.32%   84.32%   -0.01%     
  Complexity     3240     3240              
============================================
  Files           468      468              
  Lines         10163    10167       +4     
  Branches       1777     1778       +1     
============================================
+ Hits           8570     8573       +3     
  Misses          658      658              
- Partials        935      936       +1     
Impacted Files Coverage Δ
...gitlab/arturbosch/detekt/core/config/YamlConfig.kt 84.84% <80.00%> (-1.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 891bf5d...ef610e4. Read the comment docs.

* Detekt in the same VM can fail spuriously. A similar bug is referenced in
* https://github.com/detekt/detekt/issues/3396. The performance regression is likely unnoticeable.
*/
.apply { useCaches = true }.getInputStream().reader()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoudln't this be useCaches = false then? And, if this is a JDK issue, could we do only for JDK8?

And this is probably another reason to deprecate JDK8 #4130

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh! It's a remnant from trying to set up a test case but failing.

As for JDK8 only, it could be worth adding the condition, so it is detected and removed while removing support for JDK8.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the PR.

If Detekt is being executed in parallel in the same VM
but through different class loader instances, the configuration file
is sometimes not readable as a class loader might have closed
the zip stream. By telling the JVM to not use cached files readers,
the stability improves.
@cortinico cortinico added this to the 1.19.0 milestone Nov 2, 2021
@cortinico cortinico added the bug label Nov 2, 2021
@cortinico cortinico merged commit 5325ef1 into detekt:main Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants