Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to fix "Duplicate entry P1 for key OS_POS_ST_CONTS_OSPID_UQ"?

The error “Duplicate entry ABC for key OS_POS_ST_CONTS_OSPID_UQ” is raised when two or more threads are in a race condition attempting to occupy the same container slot. When two or more threads ask the question - “Give me the next free slot available in the container X?” at about the same time, all of them get the same answer. It is P1. One of the thread succeeds in using the slot P1. The other threads end up on losing side and spit the unique constraint error.

Use cases:

  1. When the user submits the same page/form twice either from the same tab or different tabs in quick successions

  2. When two or more users use the same container at about the same time.

Solution:

  1. Review, none of the container slots, are occupied by the other specimens

  2. Wait for some time and resubmit the form.

 

Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com