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

Chrome and Firefox goes in crash with Prebid.js with IAB CMP #8360

Closed
salvoaranzulla opened this issue May 3, 2022 · 12 comments · Fixed by #8362 or #8401
Closed

Chrome and Firefox goes in crash with Prebid.js with IAB CMP #8360

salvoaranzulla opened this issue May 3, 2022 · 12 comments · Fixed by #8362 or #8401
Assignees

Comments

@salvoaranzulla
Copy link

Type of issue

Chrome and Firefox goes in crash with Prebid.js with IAB CMP while reading the consent.

Description

Chrome and Firefox goes in crash with Prebid.js when IAB CMP invalidates old consent.

Steps to reproduce

  1. Close browser and open the browser in incognito mode https://www.aranzulla.it/DEBUG-iubenda-articolo.html?forceDate=2022-01-01&debug=true. Press "X" button on the right top.

  2. Open https://www.aranzulla.it/DEBUG-iubenda-articolo.html?forceDate=2022-12-01&debug=true e do not nothing.

  3. Refresh the page. On JS console, you will see a Prebid.js error:

Uncaught (in promise) SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at prebid6.21.1.js:10:1222
at Array.forEach ()
at Object.getId (prebid6.21.1.js:10:1177)
at ee (prebid6.21.1.js:18:11998)
at prebid6.21.1.js:18:12774
at Array.reduce ()
at ne (prebid6.21.1.js:18:12745)
at prebid6.21.1.js:18:7832
at prebid6.21.1.js:18:7729

  1. If you press "Accetta" button, you will see that the browser goes in crash because of RAM consumption by Prebid.js.

I have recorded a video: https://drive.google.com/file/d/1MyMwgTS35eN1p1YfU8fifN6htRX1h6U5/view?usp=sharing

Test page

I have recorded a video: https://drive.google.com/file/d/1MyMwgTS35eN1p1YfU8fifN6htRX1h6U5/view?usp=sharing

Expected results

No browser crashes.

Actual results

Browser crashes.

Platform details

Chrome / FF
Prebid.js 6.21.1

Other information

@dgirardi dgirardi self-assigned this May 3, 2022
dgirardi added a commit to dgirardi/Prebid.js that referenced this issue May 3, 2022
… infinite loop

In some situations userID submodules can throw exceptions (prebid#8360) which then, after prebid#8201, causes the ID system to get stuck in an infinite loop.
@muuki88
Copy link
Collaborator

muuki88 commented May 3, 2022

Hi @salvoaranzulla

You probably discovered #7707 .

Do you have index exchange (ix) as a bidder? The fix is easy: upgrade Prebid 🤗

@dgirardi
Copy link
Collaborator

dgirardi commented May 3, 2022

This bug was introduced in #8201 - if you're able to cause an exception in user ID retrieval (I haven't tried to understand why that odd series of steps with the CMP does), it causes an infinite loop and runaway heap memory allocation. Fix is in #8362

@salvoaranzulla
Copy link
Author

@muuki88 We are using the latest Prebid version. So it's not the bug you have linked to me.

@dgirardi Yes, if you need you can follow my steps to reproduce CMP error. I have also recorded a video: https://drive.google.com/file/d/1MyMwgTS35eN1p1YfU8fifN6htRX1h6U5/view?usp=sharing

@dgirardi
Copy link
Collaborator

dgirardi commented May 4, 2022

@salvoaranzulla the video was very helpful, thank you - bug reports are one of those things that get no comments when they're well done :)

dgirardi added a commit that referenced this issue May 4, 2022
… infinite loop (#8362)

In some situations userID submodules can throw exceptions (#8360) which then, after #8201, causes the ID system to get stuck in an infinite loop.
tpmn-admin pushed a commit to tpmn-admin/Prebid.js that referenced this issue May 9, 2022
… infinite loop (prebid#8362)

In some situations userID submodules can throw exceptions (prebid#8360) which then, after prebid#8201, causes the ID system to get stuck in an infinite loop.
@salvoaranzulla
Copy link
Author

@dgirardi I have updated my examples with latest version of Prebid.js. I keep seeing the error:

VM193:1 Uncaught (in promise) SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at prebid6.23.0.js:10:1222
at Array.forEach ()
at Object.getId (prebid6.23.0.js:10:1177)
at ne (prebid6.23.0.js:18:12119)
at prebid6.23.0.js:18:12896
at Array.reduce ()
at te (prebid6.23.0.js:18:12867)
at prebid6.23.0.js:18:7927
at prebid6.23.0.js:18:7824

The browser is not crashing anymore. Is that the expected behaviour of your bugfix?

@salvoaranzulla
Copy link
Author

salvoaranzulla commented May 10, 2022

@dgirardi With that error, the bidding is not starting. So no calls are made by Prebid.js when I see that error in JS console. The problem seems to be generated by ID5 module.

@dgirardi dgirardi reopened this May 10, 2022
@salvoaranzulla
Copy link
Author

salvoaranzulla commented May 10, 2022

@dgirardi I have found the problem. The problem is generated by this line code in ID5 module:

image (3)

The module tries to interpret the cookie pbjs-id5id as JSON but that cookie contains just a white space (which is a not a JSON):

image (1)

I think that the problem is in this function:

function getLegacyCookieSignature() {

Because that, Prebid crashes and bidding is not starting. Before your fix in the latest version, also the browser crashes.

@patmmccann
Copy link
Collaborator

@smenzer fyi

@dgirardi
Copy link
Collaborator

@salvoaranzulla would you be able to verify #8401 ?

The error you see is, as far as I can tell, due to your repro steps forcing an invalid cookie for ID5 (First set date A, which causes Prebid to try to expire the cookie with it; then roll the date back, so that Prebid sees that cookie as no longer expired - but its contents are not valid). To me that seems unlikely to happen in practice - did you run into it in production?

@smenzer
Copy link
Collaborator

smenzer commented May 10, 2022

we're on it...will post a PR shortly.

@patmmccann
Copy link
Collaborator

@smenzer could you review 8401

@smenzer
Copy link
Collaborator

smenzer commented May 10, 2022

you guys beat me too it! the PR looks good, thanks

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