RetireJS checks frequently fail due to corrupt jsrepository.json file
See original GitHub issueDescribe the bug
I frequently get this stack trace failing the dependency check:
Caused by: org.owasp.dependencycheck.exception.ExceptionCollection: One or more exceptions occurred during analysis:
Failed to initialize the RetireJS repo: `/Users/tester/.gradle/dependency-check-data/4.0/jsrepository.json` appears to be malformed. Please delete the file or run the dependency-check purge command and re-try running dependency-check.
at org.owasp.dependencycheck.Engine.analyzeDependencies(Engine.java:719)
at org.owasp.dependencycheck.Engine$analyzeDependencies$2.call(Unknown Source)
at org.owasp.dependencycheck.gradle.tasks.AbstractAnalyze.analyze(AbstractAnalyze.groovy:88)
... 85 more
I delete the file manually and that does make the next check pass, but then randomly it corrupts itself again in the future.
Version of dependency-check used
The problem occurs using version 5.3.2.1 of the Gradle plugin.
Log file
I’m unable to find any logs other than the stack trace I get in the build itself.
To Reproduce
To determine.
It happens frequently in our multi-project build, but not at all in one of my simpler single-project builds, so I’m thinking it might require a multi-project build to reproduce it, but haven’t determined anything specific yet, and our own build is private so I can’t just post it. 😦
When I see the build running, I notice that the checks are running on multiple subprojects at the same time. This could be a hint - maybe one of them reads the file while another one is actively writing data into it?
Expected behavior
-
Any updates to any file should be done atomically so that it isn’t possible for someone to find the file in a half-initialised state.
-
If the file is corrupt, it should be deleted and then treated as if it didn’t exist.
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
I am experiencing the same issue starting today. As suggested, I even removed the entire ~/.m2/repository/org/owasp/dependency-check-utils/5.3.2/ directory to try to fix the corrupted jsrepository.json file, but I get the same error for every build:
Thank you so much @jeremylong ! Looking forward to seeing the fix. 😃