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

DependencyCheck 10.0.4 tries to lock database directory even when autoUpdate is set to false #7030

Open
guidoschreuder opened this issue Oct 10, 2024 · 5 comments
Labels

Comments

@guidoschreuder
Copy link
Contributor

Describe the bug
Switching from version 10.0.2 to 10.0.4 jobs on Jenkins are getting stuck because DependencyCheck 10.0.4 tries to lock database directory even when autoUpdate is set to false.

The dataDirectory is mounted on a read-only filesystem, as we centrally update this cache to keep the NVD API from causing problems by throttling. This has worked well for us, but now this is broken

Version of dependency-check used
10.0.4

Log file
/bin/mvn -X org.owasp:dependency-check-maven:10.0.4:aggregate -DdataDirectory=/owasp-cache/owasp-api-data -DautoUpdate=false
[snip]
[DEBUG] Settings.getDataFile() - file: '/owasp-cache/owasp-api-data'
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:58:23.759)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:58:38.761)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:58:53.762)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:59:08.763)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:59:23.765)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:59:38.774)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 14:59:53.775)
[DEBUG] Sleeping thread main (a39cd3c744de8a843d0095cb26149de3) for 15 seconds because an exclusive lock on the database could not be obtained (2024-10-10 15:00:08.777)
[etc]

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
Do not try to lock the data directory when autoUpdate is set to false

Additional context
Add any other context about the problem here.

@guidoschreuder
Copy link
Contributor Author

guidoschreuder commented Oct 10, 2024

Another detail; previously we used setting the data.h2.directory but that is no longer documented and also does not work for published suppressions, so that was part of the reason for switching

@guidoschreuder
Copy link
Contributor Author

Ok, just tested this, when using data.h2.directory there is no problem with locking

So my question would then be; is there any way we can use the documented property without running into this locking issue on a RO filesystem?

@guidoschreuder
Copy link
Contributor Author

Please not that testing with a local folder that is marked read-only does NOT expose this bug, only appears to happen on a RO filesystem

@guidoschreuder
Copy link
Contributor Author

I suspect the problem lies in the creation of the defensive copy in AbstractSuppressionAnalyzer.loadCachedHostedSuppressionsRules()

A solution would be to have WriteLock always create lock files in Settings.getTempDirectory() instead of Settings.getDataDirectory()

guidoschreuder pushed a commit to guidoschreuder/DependencyCheck that referenced this issue Oct 11, 2024
@jeremylong
Copy link
Owner

A better solution would be to figure out why a lock is being used when autoUpdate=false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants