-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Duplicate UUIDs/submissions #470
Comments
we should start enforcing a uniqueness constraint on likely the current code was written with a misunderstanding of another example of the problem: https://www.flowdock.com/app/kobotoolbox/support/threads/Y1lnKnaQPTmi6NMPC_pGkV9Rl-J |
likely race condition: kobocat/onadata/libs/utils/logger_tools.py Lines 321 to 332 in 805243c
|
Community posts for referencing: https://community.kobotoolbox.org/t/unable-to-delete-or-edit-some-submissions/28102 And here too ... https://community.kobotoolbox.org/t/submissions-being-duplicated-with-same-uuid/12503/19 |
Can confirm this is occurring ~0.4% of the time (for 87 out of 23,000 instances in our case). Duplicate instances have the same Looking at Potential fixes:
diff --git a/onadata/libs/utils/logger_tools.py b/onadata/libs/utils/logger_tools.py
index 593085c..cdab22c 100644
--- a/onadata/libs/utils/logger_tools.py
+++ b/onadata/libs/utils/logger_tools.py
@@ -179,8 +179,9 @@ def create_instance(
existing_instance.parsed_instance.save(asynchronous=False)
return existing_instance
else:
- instance = save_submission(request, xform, xml, media_files, new_uuid,
- status, date_created_override)
+ with advisory_lock(xml_hash):
+ instance = save_submission(request, xform, xml, media_files, new_uuid,
+ status, date_created_override)
return instance |
I've published PR #859 with a possible solution to the race condition mentioned by @raphaelmerx and a reproduction script that allows to run tests on a local docker setup |
Thank you very much, Roberto, for your contributions! It may look like little progress has been made, but we're working on integrating your ideas. In the meantime, there is a quick-and-dirty workaround to block duplicate UUIDs (regardless of whether or not the XML is identical) if anyone needs it: use a partial unique index:
Make sure to pick a sufficiently high
|
@jnm Any chance we could implement and release this? I'm guessing more people running into this issue when migrating from the UN OCHA server in the near future. |
Example user:
https://app.intercom.io/a/apps/s6hn3a8q/inbox/inbox/conversation/16985968453
Discussion
https://www.flowdock.com/app/kobotoolbox/kobo/threads/g4mOr7lnWnyaLbdAa9WBAky5riO
The text was updated successfully, but these errors were encountered: