Is it possible that nuxeo generates duplicate uid with his UIDSequencer?

We use the extension poins “generators” to generate references stored in uid:uid … Now we have documents that have the same references. After analyzing the creation timestamp, I would say that these are documents created simultaneously … When I look at the code, I would say it is possible: the last index is read in base, incremented by the code and persisted. If two accesses occur at the same time, it must result in duplicate uid right?

(Obviously, this behavior is a bit problematic for us…)

We use nuxeo 5.8.0-HF30…

0 votes

1 answers




I would like to konw if this concurrency issue is solved in LTS 2019 ? I have got the same problem in cluster mode : several documents have the same uid. I use the uidGeneratorService and a custom sequencer in DB.

Thank you !


Yes, UIDSequencer has a flawed implementation that's not thread-safe, which is a problem in many situations. We don't recommend using it anymore.

To generate truly unique sequential ids, we recommend using a SQL directory with <autoincrementIdField>true</autoincrementIdField> specified, and inserting new entries when needed. Although this makes the directory grow, which may or may not be a problem.

Otherwise use an external mechanism to get incremental ids, like a Hibernate sequence, or a Redis INCR-based counter.

1 votes

Using SQL directory is not possible in my case, I choose to specialize postgreSQL dialect (add a function to get next value of a sequence with insertion BEFORE return) for nxuidsequencer… It's not easy to test (mandatory postgreSQL) but it works without external tool…

I planned to be interested in Redis in the near future… Thanks