Error with duplicate Ids being inserted into the databse
0
Hello, Today I launched a simple app, where users add submit a simple form for my company. As part of the request, they had to a create a few objects, qhixh were then comitted on submit. The flow looked like this: Now, 300 users logged in at the same time. While submitting, a large number of them got the following error: Duplicate column value violates its unique constraint: ERROR: duplicate key value violates unique constraint "*****$*****_pkey". I used * to represent the module and the entity. Looking though the logs, every signle one of these nodes threw this error at some point. The kicker is: ALL of this data got correctly saved into the database. Despite this, an error was still thrown, the rest of the flow (which was just sending a confirmation email, closing the page and showing a popuop) didn't run, and we got a lot of complaints. My theory as to what happened: I read during trainning that Mendix pre-fetches IDs to give to objects that are creted in Runtime. Objects that are not comitted still have an ID, I think the large number of users caused the same ID to be given to multiple users, which caused this issue. I find it suprisingly that it was still able to commt it anyways. Anyone has dealt with this issue before, and knows how to handle it? Thanks in advance.
asked
Tomas Mendes
1 answers
0
I've seen this error occur when users can double click, executing the same flow twice.