sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Sentry requests are pending indefinitely

Open antoantonydh opened this issue 4 years ago • 23 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Self-hosted/on-premise

Which package are you using?

@sentry/browser

SDK Version

7.16.0

Framework Version

Angular 14.2.6

Link to Sentry event

No response

Steps to Reproduce

Sentry requests are pending indefinitely. It is not happening to all the requests. But to the few of them randomly. I checked if it is related to the payload issue by copying the requests from the chrome network tab to postman, and it is working fine without any issues. So, it is happening only from the browser.

Capture

I tried to revert to the older version of sentry lib v7.12.1 and seems like issue is solved. Is it related to this change #5697?

Expected Result

Sentry requests should either send to server or gives some error instead of pending state

Actual Result

Capture

antoantonydh avatar Oct 26 '22 13:10 antoantonydh

I can also confirm that issue is not there after turning off the keepalive flag in the client(https://github.com/getsentry/sentry-javascript/issues/6049#issuecomment-1311310189).

antoantonydh avatar Dec 15 '22 09:12 antoantonydh

I am wondering if this is just some protection mechanism browsers employ when too many requests with keepalive are sent. I suspect this isn't an immediate problem with the SDK but rather the way keepalive works. Removing keepalive comes with tradeoffs:

+ Get rid of pending requests - Errors that happen during navigation are getting clobbered

Considering that the pending requests are more or less just randomly sampled by the browser and not sending errors during navigation prevents an entire class of errors being sent to Sentry, I am leaning towards keeping the keepalive flag. But no definitive answer here.

lforst avatar Dec 15 '22 11:12 lforst

Update: We have finally identified the underlying issue and have a fix pending to resolve this here: https://github.com/getsentry/sentry-javascript/pull/7553

Thanks for the patience on this, it was rather tricky tracking this down, but we finally got to the bottom of it!

mydea avatar Mar 21 '23 14:03 mydea