New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecommerce Tracker may fail with "Integrity constraint violation: 1062 Duplicate entry" #8597

Closed
mattab opened this Issue Aug 19, 2015 · 10 comments

Comments

Projects
None yet
2 participants
@mattab
Member

mattab commented Aug 19, 2015

2015/08/17 02:43:27 [error] 22351#0: *55895498 FastCGI sent in stderr: "PHP message: Error in Piwik (tracker): Error query: SQLSTATE[23000]: 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,

@mattab mattab added the Bug label Aug 19, 2015

@mattab mattab added this to the 2.15.0 milestone Aug 19, 2015

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 19, 2015

Member

How often does this error occur? Which Piwik version? Can you send the tracking request and steps that were used originally to reproduce it?

Member

tsteur commented Aug 19, 2015

How often does this error occur? Which Piwik version? Can you send the tracking request and steps that were used originally to reproduce it?

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 19, 2015

Member

Maybe it's an implementation problem on client side as there is PRIMARY KEY (idvisit,idorder,idaction_sku). So maybe the idorder is not increased correctly?

Member

tsteur commented Aug 19, 2015

Maybe it's an implementation problem on client side as there is PRIMARY KEY (idvisit,idorder,idaction_sku). So maybe the idorder is not increased correctly?

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Aug 19, 2015

Member

fyi: IIRC idorder = 0 is used for an "abandoned cart"

Member

mattab commented Aug 19, 2015

fyi: IIRC idorder = 0 is used for an "abandoned cart"

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 19, 2015

Member

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?

Member

tsteur commented Aug 19, 2015

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?

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Aug 19, 2015

Member

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?

Member

mattab commented Aug 19, 2015

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?

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 19, 2015

Member

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

Member

tsteur commented Aug 19, 2015

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

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 19, 2015

Member

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

Member

tsteur commented Aug 19, 2015

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

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Aug 19, 2015

Member

@tsteur looks good to me 👍

Member

mattab commented Aug 19, 2015

@tsteur looks good to me 👍

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 19, 2015

Member

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

Member

tsteur commented Aug 19, 2015

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

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Aug 20, 2015

Member

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

Member

mattab commented Aug 20, 2015

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

@tsteur tsteur closed this Aug 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment