-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Cannot run multiple instances in parallel #650
Comments
@ca-scribner Thank you for pointing it out. This limitation is from boltdb.
https://github.com/boltdb/bolt#opening-a-database As you said, it should be mentioned in README. |
@ca-scribner @knqyf263 can you guide a bit how to resolve this? I would like to work on this. Thanks |
Sorry I don't really know boltdb or the inners of trivy, but the ideal behaviour would be that one could run two instances of trivy at the same time. Maybe trivy doesn't need to keep a lock on the database for the whole scan and can instead grab the db at the start, do some things, release the lock, scan, then grab the db again? That might help with concurrent uses. I haven't tried it, but I'm guessing the client/server setup for trivy is meant to handle this sort of thing? It felt like overkill for my use case (I had a few windows open at once on my local machine) but for large scale maybe that solves this issue? |
Description
I would like to run trivy on multiple images in parallel (eg: two scripts are running separately and both will call
trivy
on different images)What did you expect to happen?
Trivy processes would be isolated and proceed as if only one was running
What happened instead?
The second trivy process to start appears to wait until the first trivy process has completed before starting
Output of run with
-debug
:Scanning
python:3.7.1
andpython:3.7.2
(with images alreadydocker pull
'd)In series:
trivy image -c ; time trivy -d image python:3.7.1
:(~14s runtime)
trivy image -c ; time trivy -d image python:3.7.2
:(~14s runtime)
If run at the same time, first one still completes in ~14s but second shows:
(completed in ~26s)
Output of
trivy -v
:Additional details (base image name, container registry info...):
running with
trivy --cache-dir someUniquDirPerProcess ...
allows the processes to run in isolation as expected. Seems like one locks the cache or db and the other waits? If this is the expected behavior, it could be documented more prominently as running multiple processes at once does not seem unlikely.Thanks!
The text was updated successfully, but these errors were encountered: