You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the edx.org site we have noticed a small number of LtiConfiguration objects show up that are duplicates for the same block location. This should not be possible since we only every create one LtiConfiguration per block based on the get_or_create call referenced below. This in the only function that can create an LtiConfiguration instance.
However, this constraint is only enforced in code and not at the database level. If multiple calls to this function are received concurrently on a site with multiple workers, it is possible to end up with multiple objects.
I believe this is the cause for two reasons:
All duplicate instances have adjacent database ids
During a period of degraded site performance or even a bad client network connection it is easy to POST multiple requests. The modal to save the lti configuration does not close or disable while a request is in flight.
Impact
If there are multiple configurations with the same location identifier the LTI unit will not render due to a lti_consumer.models.LtiConfiguration.MultipleObjectsReturned error when any code attempts to reference that config.
Possible Solutions
Add a database constraint to enforce the location attribute is unique.
This might be tricky to release since the new constraint will fail without manually cleaning up this data. It's possible other site unknowingly have this problem.
Alter the UI so it's less likely a user could submit the same configuration multiple times.
Doesn't fix the underlying issue but may make it less likely to occur
The text was updated successfully, but these errors were encountered:
zacharis278
changed the title
Potential race condition creating LtiConfiguration model
Potential creation of duplicate LtiConfiguration models
Jul 8, 2024
Problem
On the edx.org site we have noticed a small number of LtiConfiguration objects show up that are duplicates for the same block location. This should not be possible since we only every create one LtiConfiguration per block based on the
get_or_create
call referenced below. This in the only function that can create an LtiConfiguration instance.xblock-lti-consumer/lti_consumer/api.py
Line 38 in 2efe2bb
However, this constraint is only enforced in code and not at the database level. If multiple calls to this function are received concurrently on a site with multiple workers, it is possible to end up with multiple objects.
I believe this is the cause for two reasons:
Impact
If there are multiple configurations with the same location identifier the LTI unit will not render due to a
lti_consumer.models.LtiConfiguration.MultipleObjectsReturned
error when any code attempts to reference that config.Possible Solutions
The text was updated successfully, but these errors were encountered: