2015/08/17 02:43:27 [error] 22351#0: *55895498 FastCGI sent in stderr: "PHP message: Error in Piwik (tracker): Error query: SQLSTATE: Integrity constraint violation: 1062 Duplicate entry '271372268-0-154289670' for key 'PRIMARY' In query: INSERT INTO piwik_log_conversion_item (idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted, idorder, idsite, idvisitor, server_time, idvisit) VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) , ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) , ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) , ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) , ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,? ) Parameters: array ( 0 => 154289670, 1 => 154289672, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => '10', 8 => 1, 9 => 0, 10 => 0, 11 => 174, 12 => '±2|÷?^Oó*', 13 => '2015-08-17 07:43:23', 14 => '271372268', 15 => 154289670, 16 => 154289672, 17 => 0, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => '18.99', 23 =>" while reading response header from upstream,
How often does this error occur? Which Piwik version? Can you send the tracking request and steps that were used originally to reproduce it?
Maybe it's an implementation problem on client side as there is
PRIMARY KEY (idvisit
). So maybe the
idorder is not increased correctly?
idorder = 0 is used for an "abandoned cart"
So in this case I'm not sure how to fix it. Isn't it kinda by design then? Maybe the exception is okay... we could specify a "on duplicate update" but that wouldn't change much apart from getting rid of the exception?
in general, for "expected" use cases, we should avoid trigger an error in Tracking API, as such error are caught by error monitoring and can cause confusion to Piwik server administrators.
Did you manage to reproduce the exception, if yes, what are the steps? it could be possible in this case that catching exception (not trigger error) + logging a debug or warning statement, is the most correct solution?
I'm waiting for someone to send me steps to reproduce. But probably if someone sends abandoned cart twice then it will very likely throw this exception I reckon. Not sure what best solution is
Here would be a way to catch exception but not sure how useful all this is: https://github.com/piwik/piwik/compare/8597 also currently many items are created at once. Ideally we would create each item separately but this might slow down tracker
@tsteur looks good to me :+1:
What do you think re executing the items one by one? If first one fails, all items will fail. On the other side if first item is
idorder=0 probably all items will be
idorder=0 and it is maybe not important to execute any of them
What do you think re executing the items one by one?
Not sure, I reckon you fixed issue nicely in your PR #8599. please close the issue if you agree