-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
RequestIDs Repeating or Recurring over Short Periods #2822
Comments
You're right. They rely on Math.random() which apparently has a long history of varying brokenness: 2011: Google Chrome random number generator issue Here are the relevant Prebid functions: Lines 46 to 72 in a2bb255
getUniqueIdentifierStr() is used for adId/bidId/requestId, and bidderRequestId. Two suggested solutions are to either use Crypto.getRandomValues where available, or instead include a Mersenne Twister implementation (eg. https://gist.github.com/banksean/300494). |
@ScottKevill That is what I determined from reading the code and some of the same posts you mention above. Crypto.getRandomValues seems to have broad support. I'll look at patching it in for auctionId. Within the scope of an auction the current level of uniqueness appears to suffice. Performance difference between the two appears to be sub millisecond on a typical browser. |
@mkendall07 has this been discussed? Any reason not to improve this? It would make analytics much more accurate without having to rely only on streaming or other temporal analysis and we've found IDs repeating very near one another recently that have caused issues with that approach. Happy to submit a PR on this. I've done some initial testing and a single GUID for at least auctionId would not be terribly performance impacting. The other IDs in that context should then have sufficient uniqueness. The same gist used for the current version has a crypto.getRandomValues version also. https://gist.github.com/jed/982883 |
@dbemiller do you have any insight on this? I'd like to make PR for a change, but don't want to rehash old ground if there is existing discussion or work in the area which I could leverage. |
I'm not aware of any previous discussions... but I probably wouldn't have been involved in the project that long ago. My thoughts are below:
is only fair if these functions are called a few times on a page. If you're worried about performance, it's also worth seeing how many calls are made when loading a typical page. I also skimmed the most popular UUID-generating library that I could find, and it does use crypto whenever it's available. Two other things worth noting:
This suggests two things:
I don't think the Mersenne twister is a good option here. If you don't give it a seed, it uses use the current time. Since many users view your page simultaneously, I expect you would still see quite a few conflicts this way. If we did give it a seed, would we generate that seed with |
Not exactly, it's nuanced. Even if Mersenne Twister were seeded with the current time, it would still be an improvement on That said, the only reason to use Mersenne Twister would be if performance were a concern -- which I highly doubt, given how few random values are required with Prebid. If enough random values were required that performance became a problem, then you'd seed Mersenne Twister with TL;DR: Use |
Agreed with all that ^^ |
hey all. Sorry was late to this thread. I'm in agreement with the suggested approach. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@mkendall07 @dbemiller PR incoming after we finish internal testing, probably shouldn't be marked stale |
@GLStephen any updates on this? |
@mkendall07 PR is incoming |
We are seeing instances of requestId (auctionId) recurring over short periods of time. Different IPs, pageviews and UAs. Is the requestId/auctionId generator sufficient to create true GUIDs? Just to be clear, we're 100% sure this is not some form of duplicate data in our ingestion.
The text was updated successfully, but these errors were encountered: