Skip to content
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

Userids are randomly double-hashed #141

Open
danielpradilla opened this issue Oct 23, 2020 · 11 comments
Open

Userids are randomly double-hashed #141

danielpradilla opened this issue Oct 23, 2020 · 11 comments

Comments

@danielpradilla
Copy link

Using Matomo 3.14.1

When pseudonimization is enabled, sometimes the user_id is hashed twice, creating an artificial duplicate visit.

In the attached image, dacc63938... is a hash of the username, f7d09460... is a hash of dacc63938... a hash of the hash of the username.
double-hash

Happens randomly, I cannot reproduce on a controlled environment, only in a site with large amount of visits.

@tsteur
Copy link
Member

tsteur commented Oct 25, 2020

Hi @danielpradilla any chance the plugin queued tracking is enabled on the environment with large amount of visits?

@danielpradilla
Copy link
Author

Hi @tsteur it is!

@tsteur
Copy link
Member

tsteur commented Oct 26, 2020

Thanks @danielpradilla that was the only way I could think of out of the box how this might happen. I now had a quick look at the code but it's not obvious yet to me how this might happen.

Could you check in Administration -> General Settings under Queued Tracking if the setting "process during tracking request" is enabled maybe?
image

I suppose queued tracking is always enabled or does it sometimes get deactivated?

@tsteur
Copy link
Member

tsteur commented Oct 26, 2020

Also are you using the JavaScript tracker to track a website?

@danielpradilla
Copy link
Author

Hi @tsteur it’s always enabled. I’ve never touched it. I’m using the JS tracker.

@tsteur
Copy link
Member

tsteur commented Oct 26, 2020

@danielpradilla any chance you could check regarding the other setting I mentioned?

@danielpradilla
Copy link
Author

@tsteur apologies, i meant that both queued and process during tracking request are enabled. I will experiment turning queued tracking off.

@tsteur
Copy link
Member

tsteur commented Oct 26, 2020

Thanks. Any chance you know roughly how often that happens? Does this happen randomly rather often or quite rarely?

Note: If I had to guess I would say that we should maybe make a copy of a RequestSet and all includes requests in https://github.com/matomo-org/plugin-QueuedTracking/blob/4.0.1/Queue/Processor/Handler.php#L46 so if the requests will be retried, then we wouldn't manipulate it again. So my theory is that rarely maybe a request fails for some reason and then it retries the requests and it basically modifies the same requestset again.

@danielpradilla
Copy link
Author

It happens quite a lot. About half of the logged-in visits are affected. Randomly. It's not tied to a particular visitor.

@tsteur tsteur transferred this issue from matomo-org/matomo Oct 28, 2020
@tsteur
Copy link
Member

tsteur commented Oct 28, 2020

Thanks @danielpradilla

Are you familiar with applying patches? Could you try to apply this patch https://github.com/matomo-org/plugin-QueuedTracking/compare/4.x-dev...qt141?quick_pull=1 in plugins/QueuedTracking/Queue/Processor/Handler.php and see if this maybe fixes the issue?

@tsteur
Copy link
Member

tsteur commented Nov 2, 2020

@danielpradilla have you had a chance to give this a try maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants