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

Ensure Update is in session before linking relationships #5840

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

mattiaverga
Copy link
Contributor

In production I have been seeing SQLAlchemy warnings like:

2025-01-06 08:12:34,735 INFO [bodhi.server][ThreadPoolExecutor-0_0] Creating new update: [<RpmBuild {'nvr': 'perl-Net-OAuth-0.30-1.el10_0', 'signed': False, 'release_id': 83, 'type': 'rpm', 'epoch': 0}>]
2025-01-06 08:12:34,736 WARNI [bodhi.server][ThreadPoolExecutor-0_0] No JSON file found for collection epel10
/usr/lib/python3.12/site-packages/bodhi/server/models.py:2134: SAWarning: Object of type <Update> not in session, add operation along 'User.updates' will not proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
u = Update.query.filter(Update.release_id == release.id, Update.id != self.id).first()
/usr/lib/python3.12/site-packages/bodhi/server/models.py:2134: SAWarning: Object of type <Update> not in session, add operation along 'Bug.updates' won't proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
u = Update.query.filter(Update.release_id == release.id, Update.id != self.id).first()
/usr/lib/python3.12/site-packages/bodhi/server/models.py:2134: SAWarning: Object of type <Update> not in session, add operation along 'Build.update' won't proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
u = Update.query.filter(Update.release_id == release.id, Update.id != self.id).first()
2025-01-06 08:12:35,042 INFO [bodhi.server][ThreadPoolExecutor-0_0] Deferring working on bugs and fetching test cases to celery

This seems to happen for updates with bugs.
With this PR I'll try to add the relationships only after the update is added to the session. The tests seems happy with this, so let's try...

@mattiaverga mattiaverga requested a review from a team as a code owner January 11, 2025 18:05
@mattiaverga mattiaverga merged commit 65afed4 into fedora-infra:develop Jan 17, 2025
30 checks passed
@mattiaverga mattiaverga deleted the session-warnings branch January 17, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant