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

Fix potential Invalid state. Transaction has already started in RepositoryMetaAnalyzerTask #2678

Merged

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Apr 16, 2023

Description

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 QueryManagers 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. #2677 has been raised to address this for the entire application.

Addressed Issue

Relates to #2677.

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

…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>
@nscuro nscuro added the defect Something isn't working label Apr 16, 2023
@nscuro nscuro added this to the 4.8 milestone Apr 16, 2023
@nscuro nscuro merged commit 44b4b90 into DependencyTrack:master Apr 16, 2023
@nscuro nscuro deleted the fix-trx-has-already-started-exception branch April 16, 2023 18:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant