-
-
Notifications
You must be signed in to change notification settings - Fork 597
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
Database transactions should be rolled back when committing fails #2677
Comments
We already have dependency-track/src/main/java/org/dependencytrack/persistence/QueryManager.java Lines 1256 to 1267 in 93321f8
|
…positoryMetaAnalyzerTask` The task works in such a way that a single `QueryManager` (and thus DN `ExecutionContext` and associated transaction) is shared across analyses of multiple components. Failure to analyze one component does not abort the overall analysis for all components. Due to missing transaction rollbacks, the `RepositoryMetaAnalyzerTask` could end up in a situation where the `QueryManager`s active transaction failed to commit for one component, such that persisting of results for all following components would fail with `NucleusTransactionException: Invalid state. Transaction has already started`. This fix is a mere workaround for the missing rollback of the `persist` method. DependencyTrack#2677 has been raised to address this for the entire application. Signed-off-by: nscuro <nscuro@protonmail.com>
Resolved in Alpine 2.2.6 via stevespringett/Alpine#552. |
Signed-off-by: nscuro <nscuro@protonmail.com>
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Current Behavior
The
persist
methods provided byAbstractAlpineQueryManager
and inherited by DT'sQueryManager
do not rollback the active transaction when committing of the same fails. For examplepersist(T)
:Because none of those methods check whether a transaction is already active, and always start a new one instead (via
PersistenceManager#currentTransaction()#begin
), all operations following the initial failure with also fail with:This can happen in situations similar to this one, where a single
QueryManager
instance is shared across multiple operations, and a single operation failing does not abort the overall execution:If the first invocation of
doStuff
fails on commit, all other invocations will fail as well.Proposed Behavior
Database transactions should be rolled back when committing fails.
Checklist
The text was updated successfully, but these errors were encountered: