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

Too many logs and errors for OidcKeepAliveServiceWorker fetches #1350

Open
wermanoid opened this issue Apr 17, 2024 · 1 comment · May be fixed by #1355
Open

Too many logs and errors for OidcKeepAliveServiceWorker fetches #1350

wermanoid opened this issue Apr 17, 2024 · 1 comment · May be fixed by #1355

Comments

@wermanoid
Copy link

wermanoid commented Apr 17, 2024

Issue and Steps to Reproduce

Too much failed requests when trying to fetch OidcKeepAliveServiceWorker.json, that leads to bunch of errors in network tab and console logs. Also process is random and sometimes it could stay clean for some time.

To Reproduce

You need just run OIDC client with tokens refresh and wait until OidcKeepAliveServiceWorker will start randomly write error logs

Versions

Latest

Screenshots

image
image

Expected

Library should not spam error logs into console, especially when error is random and does not impact on app. This is confusing

Actual

Too much errors in browser.

Additional Details

In OidcServiceWorker.ts there is a function keepAlive and it has this randomiser:

for (let i = 0; i < minSleepSeconds; i++) {
    await sleep(1000 + Math.floor(Math.random() * 1000));
    const cache = await caches.open('oidc_dummy_cache');
    await cache.put(event.request, response.clone());
}

Problem is next:

  • Chrome oob timeout: 300 sec
  • Firefox oob timeour: 90 sec

And it is weird, that random function over 150 times resolves into same values (like we have always sleep(2000) result). Here, my assumption, this also might be related to sleep function implementation. As it triggers setTimeout, there is no guarantee that this timeout will be executed immediately, as other functions in app/service worker could also inject some functions into browser call stack. So that leads to longer delays.

This leads to situation when network tab and console are overwhelmed with errors, as this timer:

  • always higher then Firefox threshold
  • regularly (but randomly) exceed 5min in Chrome

Proposals

Not sure what could be better, but some ideas:

  • make it configurable from client side
  • make it adjustable according to different browsers limits
  • just make it once per 25 sec without any randomizer
@wermanoid wermanoid changed the title Too many false negative OidcKeepAliveServiceWorker fetches Too many logs and errors for OidcKeepAliveServiceWorker fetches Apr 17, 2024
@wermanoid
Copy link
Author

wermanoid commented Apr 17, 2024

Probably #1303 has same source

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