Skip to content

Commit

Permalink
remove mixin loop (#743)
Browse files Browse the repository at this point in the history
This PR removes a infinite recursion in save method when sync to
bugzilla is disabled.

This commit
db2cc6f
introduced a infinite recursion in environments that don't sync to
bugzilla, when validations were separated from BugzillaSyncMixin, was no
need to bzsync method to skip mixins / call the next save method, making
this infinite loop.

The way the 409 used to happen was by calling save method multiple times
until the current save call have a different timestamp from the 1st save
call, throwing the exception presented in
https://github.com/RedHatProductSecurity/osidb/blob/master/osidb/mixins.py#L52

Closes OSIDB-3430.
  • Loading branch information
jobselko authored Sep 23, 2024
2 parents e52d05f + bcf24cb commit 79b018b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Alert users when Bugzilla sync failed (OSIDB-3252)

### Fixed
- Remove infinite recursion when SYNC_FLAWS_TO_BZ is disabled (OSIDB-3430)

## [4.3.2] - 2024-09-19
### Changed
- Update the release documentation (OSIDB-3384)
Expand Down
8 changes: 0 additions & 8 deletions osidb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
NullStrFieldsMixin,
TrackingMixin,
TrackingMixinManager,
ValidateMixin,
)
from .sync_manager import BZSyncManager, FlawDownloadManager, JiraTaskDownloadManager
from .validators import no_future_date, validate_cve_id, validate_cwe_id
Expand Down Expand Up @@ -1328,13 +1327,6 @@ def bzsync(self, *args, force_synchronous_sync=False, **kwargs):
Bugzilla sync of the Flaw instance
"""
if not SYNC_FLAWS_TO_BZ:
# up until now the parent save methods run in sequence of
# 1) TrackingMixin with auto-timestamps on
# 2) JiraTaskSyncMixin syncing the task if enabled
# 3) BugzillaSyncMixin running the validations
# so we do not need to run any other mixins
kwargs.pop("raise_validation_error", None)
super(ValidateMixin, self).save(*args, **kwargs)
return

# switch of sync/async processing
Expand Down

0 comments on commit 79b018b

Please sign in to comment.