A race condition is possible when a POST request for uc_paypal/ipn/%uc_order arrives around the same time as a customer's GET request for cart/checkout/complete.

The IPN request fails with a 500 error, after logging the IPN as received. Therefore, the repeat IPN attempt will not actually be processed, an "IPN transaction ID has been processed before" notice will be logged, and the order will remain stuck in "Pending" status despite being fully paid.

The 500 error is due to PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry for key 'name': INSERT INTO {users} (uid, name, pass, mail, created, status, init) ... Both of these requests call uc_cart_complete_sale(), which calls uc_cart_complete_sale_account() where the user_save() happens.

A potential solution would be to catch an exception thrown by user_save, and look for the pre-existing user account again.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mfb created an issue. See original summary.

mfb’s picture

Status: Active » Needs review
FileSize
958 bytes
TR’s picture

Status: Needs review » Closed (duplicate)