#386 Race condition when module enters the wait state
Closed: Fixed 7 years ago Opened 7 years ago by ralph.

Took me a while to get my head around this one.

When the user submits a module, we publish about init, then we check all the git refs, embed the xmd data, and then publish the wait state, and then we session.commit() the modified modulemd with the new xmd data.

It is possible (and frequent in prod, due to load on the shared db host) for the session.commit() to not finish before the backend picks up the message and starts processing the request. The module is present in the db and has a modulemd.. but the xmd values are missing and so it fails.

As a shortterm workaround, we can time.sleep() in the wait() function.

Long term, we should modify our messaging code to queue up messages, but only fire them at the end of a flask request or at the next sqlalchemy commit transaction.

See an example of this in the bodhi sourcecode here: https://github.com/fedora-infra/bodhi/blob/develop/bodhi/server/notifications.py#L49-L75


As of the short-term solution, I would extend this with a loop waiting till module contains .mmd().xmd['mbs'] and with the retry decorator, so that it is more robust. What do you think about it?

Yes, that is better. :)

Commit 689c671 fixes this issue.

Metadata Update from @fivaldi:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

7 years ago

Metadata Update from @fivaldi:
- Issue assigned to fivaldi

7 years ago

See #390 for long-term solution.

Login to comment on this ticket.

Metadata