---
** [tickets:#8232] DuplicateKeyError can happen on forum thread ids**
**Status:** open
**Milestone:** unreleased
**Created:** Mon Sep 17, 2018 10:01 PM UTC by Dave Brondsema
**Last Updated:** Mon Sep 17, 2018 10:01 PM UTC
**Owner:** nobody
I've seen this happen:
```
DuplicateKeyError: (u'E11000 duplicate key error collection:
project-data.forum_thread index: _id_ dup key: { : "168e810d" }'
```
I believe this is because the Thread class has `_id = FieldProperty(str,
if_missing=lambda: h.nonce(8))` and the `nonce` function uses hexadecimal so
there are 16^8 = 4.3B possibilities, and with many documents in your system,
picking one of 4.3B possibilities might happen to be an existing value. We
could increase the size of that to 9 or 10, and/or handle the error better
(retry?)
---
Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed
to https://forge-allura.apache.org/p/allura/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is
a mailing list, you can unsubscribe from the mailing list.