fix(fossology): rollback clearingState when upload preparation fails#4037
Open
Aman-Cool wants to merge 2 commits intoeclipse-sw360:mainfrom
Open
fix(fossology): rollback clearingState when upload preparation fails#4037Aman-Cool wants to merge 2 commits intoeclipse-sw360:mainfrom
Aman-Cool wants to merge 2 commits intoeclipse-sw360:mainfrom
Conversation
Contributor
Author
|
Hey @GMishx, found a bug where a FOSSology trigger failure leaves the release permanently stuck at |
Contributor
Sandipmandal25
left a comment
There was a problem hiding this comment.
just one concern about exception handling added a comment below
backend/fossology/src/main/java/org/eclipse/sw360/fossology/FossologyHandler.java
Outdated
Show resolved
Hide resolved
backend/fossology/src/main/java/org/eclipse/sw360/fossology/FossologyHandler.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@Sandipmandal25, Wrapped the rollback call in its own try-catch so if CouchDB is also down, the rollback failure gets logged but swallowed and the original exception always propagates cleanly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When triggering a FOSSology upload, the handler marks the release as
SENT_TO_CLEARING_TOOLin CouchDB before it actually tries to fetch the attachment and upload it. If anything goes wrong during that prep work (missing attachment content, transient DB error, etc.), the exception just bubbles up and the clearing state never gets reset; leaving the release permanently stuck with no way to re-trigger from the UI.This fix wraps the risky part in a try-catch so that on any failure, we reset the step back to
NEWand writeNEW_CLEARINGback to the document before re-throwing, the same cleanup that already happens on a normal upload failure response.Issue: NA
Suggest Reviewer
@GMishx
How To Test?
SENT_TO_CLEARING_TOOLeven though nothing was sent. Re-triggering is blocked.NEW_CLEARINGand you can retry once the attachment issue is resolved.No new tests added; the existing FOSSology handler tests cover the upload step; manual reproduction is straightforward with a CouchDB document edit.
Checklist
Must: