In the last few days I've received multiple orders that were paid for using PayPal Website Payments Standard where my log entries for the transaction looked like this (image attached showing the actual entries):

  • Receiving IPN at URL for order X.
  • IPN transaction verified.
  • PDOException: SQLSTATE[23000]: Integrity constraint...
  • PDOException: SQLSTATE[23000]: Integrity constraint...
  • Receiving IPN at URL for order X.
  • IPN transaction verified.
  • IPN transaction ID has been processed before.

The integrity constraint issue is the same for both of the logged errors:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'XXXXXX' for key 'name': INSERT INTO {users} (uid, name, pass, mail, created, status, init, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 999 [:db_insert_placeholder_1] => XXXXXX [:db_insert_placeholder_2] => XXXXXX [:db_insert_placeholder_3] => XXXXXX@gmail.com [:db_insert_placeholder_4] => 1337007128 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => XXXXXX@gmail.com [:db_insert_placeholder_7] => a:1:{s:7:"contact";i:1;} ) in drupal_write_record() (line 7020 of /home/XXXXXX/public_html/includes/common.inc).

Multiple attempts are being made to insert the user account into the database and two attempts are being made to process the payment. The order is left in "Pending" state, not "Payment received", but my PayPal account shows that the payment has been received. Strangely, I've also processed PayPal payments without error so I'm not sure what the customers might be doing to trigger this error.

Files: 
CommentFileSizeAuthor
log.jpg45.91 KBsah62

Comments

Status:Active» Postponed (maintainer needs more info)

I wonder why the IPN was sent twice for the same order, I haven't seen this before. I am guessing that is the source of the problem, but really need a reproducible way of causing this in order to track it down.

Understood. I'll keep an eye on my orders to see if I can figure something out.

Is this still an issue, or has it resolved itself?

I haven't seen it again. It's probably not worth keeping this issue open.

Status:Postponed (maintainer needs more info)» Closed (cannot reproduce)

Thanks.

Sorry for posting to a closed topic, but it figures - right after the above exchange my next PayPal order acted up. This time I didn't get the duplicate IPN problem, but I did get the PDOException error when a second attempt was made to create a user account. I have the log entry, but it's the same as in my original post. Is there anything else I can do to help debug this?

Status:Closed (cannot reproduce)» Active

Not sure what we can do to debug this further except trace the flow and try to prevent this from happening twice.

We've just gone live with Paypal WPS and I'm seeing the same thing with some orders. The customers completed successfully on Paypal, payment has been taken, but the status in Ubercart is set to Pending. The log suggests that the IPN was sent twice, and that the receipt of the duplicate IPN is treated as an error with the consequent change to Pending status:

uc_paypal 2012-08-21 15:16 Receiving IPN at URL for order 19.
uc_paypal 2012-08-21 15:16 IPN transaction verified.
uc_paypal 2012-08-21 15:16 Receiving IPN at URL for order 19.
uc_paypal 2012-08-21 15:16 IPN transaction verified.
uc_paypal 2012-08-21 15:16 IPN transaction ID has been processed before.

My sales were to anonymous users which may explain why we didn't also have the integrity constraint issue. We're trying to get some information from the affected customers about which browser they used, whether they completed the Paypal process including the return click back to our site, etc.

I'm quite new to this, but if anyone's got ideas for further ways I could investigate the issue that would be helpful. I couldn't reproduce the problem on our development site linked to Paypal Sandbox.

I have a similar (the same?) error... How can I check logs to see if it's the same error? I'm not very experienced in debugging stuff ;-)
Ps. By the way, I'm using 6.29 ubercart version... and I have this problem from a month ago, I think, maybe when I've updated ubercart code...

Want to add my observations from the thread:

On my website I have an anonymous checkout. http://achtungdiekurve.net/cart/add/e-p2_q1-ipremiumyear?destination=car... . People can fill in their email and username. If they fill in a new email, but with a username that already exists, it will go on with the checkout, but when the payment is received, it won't create the new account, because the username is already taken by another email address. An error is thrown, and that's it.

So, this needs a more graceful solution.

The following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'jasper123' for key 'name': INSERT INTO {users} (uid, name, pass, mail, created, status, init) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 158585 [:db_insert_placeholder_1] => jasper123 [:db_insert_placeholder_2] => $S$DQSfYiX.4ui0KDLUr3Dph/b5fdMCi/9otsANQkgtvVhjKwbMLVD3 [:db_insert_placeholder_3] => AN EMAIL ADDRESS [:db_insert_placeholder_4] => 1347380897 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => AN EMAIL ADDRESS ) in drupal_write_record() (line 7036 of /public_html/includes/common.inc).

on /uc_paypal/ipn/[ipn-number]

I have the same problem but with Google Checkout.

Title:Duplicate IPN Processing and User Account Database Integrity Constraint Error with PayPal Website Payments StandardDuplicate IPN Processing and User Account Database Integrity Constraint Error with PayPal WPS and Google Checkout

Just to chime in that I've seen the same error when using DPS PxPay (http://drupal.org/project/uc_paymentexpress). The problem appears to be intermittent and rare. In the most recent case, my logging indicates that Drupal received two payment notifications one second apart.

I agree with the observation on #11 which explains the transaction details cannot be inserted in the table because jasper123 already exists, i.e. Ubercart does not verify if a username already exists. Do you think that is the cause?

If so, then we need to add user validation found here: http://api.drupal.org/api/drupal/modules%21user%21user.module/function/u...

something like:

$user = user_load_by_name($name);
if($user) {
// user exists, please choose a different username
}
else {
    // Carry on with the checkout form
}

We can also query the database or we may hook the form depending on existing code. Now, the question is where is the responsible code. I tried looking but there are many files, I will try again. I'm sure longwave would know.

Am I in the right direction. Do you allow anonymous checkout like me? I'm also using uc_addresses.

Just for info, I don't think it has effect, on the website showing the error I imported about 5000 users from oscommerce site and created unique usernames (email address first part plus a number).

Right, I had another look and found the username validation already exists in uc_cart_checkout_pane.inc line 154:

if (db_query("SELECT uid FROM {users} WHERE name LIKE :name", array(':name' => $pane['new_account']['name']))->fetchField()) {

Now, I think this validates users who use the checkout form. Is there a validation in place for those using paypal express or google checkout. Is uc_paymentexpress similar and doesn't require going through the checkout form?

If true, this needs further investigation and I'll try to look into it again when I get time despite my limited experience with Ubercart.

Status:Active» Fixed

#1985404: New user creation fails if customer specifies a username but then clears it has hopefully fixed this issue. Please apply the patch from that issue, or use the latest -dev version, and if you are still experiencing this problem, reopen this issue with more details.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.