You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Running in parallel takes same time as series run
129
-
When running trivy on multiple images simultaneously, it will take same time as running trivy in series.
130
-
This is because of a limitation of boltdb.
131
-
> Bolt obtains a file lock on the data file so multiple processes cannot open the same database at the same time. Opening an already open Bolt database will cause it to hang until the other process closes it.
128
+
### Database and cache lock errors
132
129
133
-
Reference : [boltdb: Opening a database][boltdb].
130
+
!!! error
131
+
```
132
+
cache may be in use by another process
133
+
```
134
+
135
+
!!! error
136
+
```
137
+
vulnerability database may be in use by another process
138
+
```
139
+
140
+
By default, Trivy uses BoltDB for its vulnerability database and cache storage. BoltDB creates file locks to prevent data corruption, which means only one process can access the same database file at a time.
141
+
142
+
As stated in the BoltDB documentation:
143
+
144
+
> Please note that Bolt obtains a file lock on the data file so multiple processes cannot open the same database at the same time. Opening an already open Bolt database will cause it to hang until the other process closes it.
- Multiple Trivy processes try to use the same cache directory simultaneously
151
+
- A previous Trivy process did not shut down cleanly
152
+
- Trivy server is running and holding locks on the database and cache
153
+
154
+
#### Important Note
155
+
156
+
Running multiple Trivy processes on the same machine is **not recommended**. Using the same cache directory for multiple processes does not improve performance and can cause unexpected errors due to BoltDB's locking mechanism.
Note that each cache directory will download its own copy of the vulnerability database and other scan assets, which will increase network traffic and storage usage.
0 commit comments