snowplow / snowplow-javascript-tracker

Snowplow event tracker for client-side and server-side JavaScript. Add analytics to your websites, web apps and servers.
http://snowplowanalytics.com
BSD 3-Clause "New" or "Revised" License
555 stars 222 forks source link

ResiezObserver loop completed with undelivered notifications #1306

Open sykes10 opened 7 months ago

sykes10 commented 7 months ago

Describe the bug After upgrading @snowplow/browser-tracker from version 3.22.1 to version 3.23.0 we have been getting thousands of Bugsnag with the message ResiezObserver loop completed with undelivered notifications.

This message is reported for all browsers and OS using our website.

We don't have any instances of ResizeObserver in our codebase that might be causing this.

To Reproduce Run the latest version of @snowplow/browser-tracker and capture the errors with a tool like Sentry or Bugsnag. We don't know how to trigger it, but Bugsnag reports this error for each session.

Expected behaviour No errors should be reported.

Observations Checking the codebase I see the ResizeObserver being registered but not unregistered at https://github.com/snowplow/snowplow-javascript-tracker/blob/1a073e4ef57cce3d5307ec2ed7a9f1e3a022ff9f/libraries/browser-tracker-core/src/helpers/browser_props.ts#L34.

matus-tomlein commented 7 months ago

Hi @sykes10, thank you for reporting this problem!

I have tried to reproduce it using a demo React app with the JS tracker version 3.23.0 and installed BugSnag, but wasn't able to produce the errors that you are getting.

Could you please help us investigate this deeper? Searching for the problem, I see that it is often happening due to users having some browser extensions installed. Do you see the problem happening for all users or certain browsers/setups? Are you able to reproduce this locally?

sykes10 commented 7 months ago

Hi @matus-tomlein, Thanks for your quick reply, first I can confirm that downgrading the package to 3.22.1 stops all the Bugsnags.

Our application is a Nuxt app version 3.8.2 with vue 3.3.13 to give you more context.

I also checked the demo you linked and see that the Snowplow version you have in the package.json is 3.14.0 but the error is introduced in 3.23.0. Could you double-check that it was tested with the right version?

Also here's a list of some browsers that are experiencing this. image

I will try to find a way to recreate this on our own and get back to you soon.

miike commented 7 months ago

@sykes10 Just following up on this one - did you manage to find a way to recreate this?

sykes10 commented 7 months ago

I've been busy these last days but I will try to create a reproducible environment this week.

AngusMorton commented 4 months ago

We're seeing this too, could this be because readBrowserProperties() triggers a forced synchronous layout?

So, the ResizeObserver calls readBrowserProperties() which forces a synchronous layout that then enqueues a new resize observer notification if the body size changes.