50

I'm attempting to track down the cause of a rare bug (love those intermittent bugs) where a customer selects to Register at time of checkout, but when the order is completed, Magento somehow fails to save the customer record. This results in an orphan order with no email address, a difficult customer service situation.

Here are the results of my investigations so far:

  • The Sales Order View in adminhtml reports that the customer is a Guest and the email address is blank. Billing and Shipping addresses are visible.
  • customer_is_guest is false in sales_flat_order
  • The sales_flat_order entry links to a valid record in sales_flat_order_address.
  • The sales_flat_order_address record contains values for customer_id and customer_address_id however those linked records do not exist.
  • There is no discernible pattern in customer information, products ordered, payment methods.
  • There are no relevant entries in system.log, exception.log, apache error logs, var/reports or any other logs that I'm aware of.

Thoughts:

  • the customer save is progressing far enough that an ID is generated.
  • there is an observer on customer_save_after that is causing a rollback of the save?
  • a low-level database error is causing the save to fail.

Does anyone have any suggestions on how to track this down?

Version is Enterprise 1.9.

codingbadger
  • 42,678
  • 13
  • 95
  • 110
Jonathan Day
  • 18,519
  • 10
  • 84
  • 137
  • @Anton - it doesn't seem to matter what payment method. some are Paypal, some Cybersource. – Jonathan Day May 24 '11 at 10:38
  • Which magento version you use? As I can see, customer and order saving are wrapped into one transaction. And I don't see any observer on customer_save_after event in core modules which deletes customer (i found only 2 observers for this event and they both are in newsletter module). – Dmytro Zavalkin May 24 '11 at 11:24
  • @Zyava - this is on Enterprise v1.9 - I agree, I don't see any customer_save_after observers that are relevant either. I also would have thought that an exception in the save of the customer would roll back the order save too... – Jonathan Day May 24 '11 at 11:58
  • I think that your user address validation fails when customer address is converted to quote, this is resulting empty customer data in quote and the error is not raised and order is saved never the less. – Anton S May 24 '11 at 12:02
  • 15
    In addition to this forum, I would definitely contact the Magento staff. They have a vested interest in the Enterprise version being bug free. They can at least point you in the right direction. Sorry I don't have more to offer than that. – Joe Mills Jun 02 '11 at 00:54
  • Can you reproduce this issue consistently? – thaddeusmt Jun 02 '11 at 01:57
  • @thaddeusmt - unfortunately no, it's quite rare (about once every 500 orders) and with no pattern that I can see – Jonathan Day Jun 02 '11 at 03:11
  • Are you logging errors? E.g. probably the query fails which should store the record. It's a dump guess, but as it's not really reproduce-able always, there must be some trigger. – hakre Jun 15 '11 at 17:44
  • @hakre - yes, that would be the bit where I said "There are no relevant entries in system.log, exception.log, apache error logs, var/reports or any other logs that I'm aware of" – Jonathan Day Jun 16 '11 at 05:31
  • What about sales_flat_quote and sales_flat_quote_address? quote is saved in the same transaction but before order. Do you see all related rows there? – Dmytro Zavalkin Jun 20 '11 at 20:09
  • 1
    Are the inserts assigning any numeric field that should be auto incrementing on the db? Maybe some concurrency issue? Using InnoDB? – planestepper Jun 24 '11 at 05:29
  • Have you tried verifying your DB with this: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool ? also, is there a pattern in User-Agent, and/or do you have some other mechanism on your site to verify javascript is enabled? – Mike Venzke Jul 05 '11 at 03:22
  • @Mike thanks, the DB successfully processes 99.8% of customer creates so I don't expect there are any database structure issues. This is a very high volume site with no other major issues. The user would not have been able to start or complete a checkout if their javascript is disabled, so I'm not sure how that is relevant? – Jonathan Day Jul 05 '11 at 03:39
  • I observe the same behavior on Magento 1.9.x (+ all patches) for months. So far, I've just added a workaround that "reconnects" the orders afterwards and logs everything to try to understand the root cause, ... no luck so far. It seems related to a similar bug introduced by SUPEE-9767: https://magento.stackexchange.com/questions/177035/supee-9767-patch-ce-1-9-3-3-one-page-checkout-customer-registration-issue – user1966786 Jun 03 '17 at 08:56

1 Answers1

2

I would add lots of extra logging, try to log it well enough to capture the bug - and to save those logs if the bug can be detected.

Once you have logs that show the bug, you can then isolate the problematic code more easily.

For this, you may need to log the database queries, which might, unfortunately, be tricky if the volume of data is high and/or subject to privacy concerns.

Arafangion
  • 11,517
  • 1
  • 40
  • 72