question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Long latencies from MSAL leading to timeouts

See original GitHub issue

Core Library

MSAL Node (@azure/msal-node)

Core Library Version

1.14.1

Wrapper Library

Not Applicable

Wrapper Library Version

None

Public or Confidential Client?

Confidential

Description

We are experiencing long latencies when calling several methods for our Confidential client. I would imagine some network latencies occuring for SOME of these methods but the one that concerns me is getAuthCodeUrl. This method is used to generate the redirect/sign-in URL to AAD. I would not expect these calls to ever take > 15 seconds to execute (We configured Promise.race of 15 seconds). In the last 24 hours, we’ve received 62 hits on this method taking greater than 15 seconds.

Some other methods that are also showing timeouts on our side are:

  • AcquireTokenByCode
  • AcquireTokenByRefreshToken

Error Message

No response

Msal Logs

No response

MSAL Configuration

return new msal.ConfidentialClientApplication({
            auth: {
                clientId,
                authority: this._authority,
                clientCertificate: {
                    thumbprint: pem.thumbprint,
                    privateKey: pem.privateKey,
                    x5c: pem.certificate,
                },
            },
        });

Relevant Code Snippets

private async sendRequest<T>(
        log: CommonEventLogger.Scope,
        operationPromise: Promise<T>
    ): Promise<T> {
        const timeoutMs = 15000; // 15 seconds
        try {
            return await CommonUtils.promiseTimeout<T>(
                <msalMethodPromise>,
                timeoutMs,
                ErrorCodes.MsalTimeoutError({ timeoutMs })
            );
        } catch (err) {
            throw this.mapError(err, log);
        }
    }

Reproduction Steps

Unfortunately, we do not have repro steps for forcing a timeout to occur.

Expected Behavior

I would expect getAuthCodeUrl not to take > 15 seconds to generate.

Identity Provider

Azure AD / MSA

Browsers Affected (Select all that apply)

None (Server)

Regression

No response

Source

Internal (Microsoft)

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
r-delgadillocommented, Nov 7, 2022

FYI, we’ve monitored and do not have any concerns about our event loop delay in NodeJS.

0reactions
bgavrilMScommented, Nov 21, 2022

Root cause not resolved, still trying to root cause the issue from #4879

Read more comments on GitHub >

github_iconTop Results From Across the Web

Token cache serialization (MSAL.NET) - Microsoft Entra
Total time spent in MSAL, including network calls and cache. Alarm on overall high latency (> 1 second). Value depends on token source....
Read more >
Release 1.20.0 Microsoft - MSAL Python documentation
Alternatively, you can configure a short timeout, or provide a custom http_client which has a short timeout. That way, the latency would be ......
Read more >
Advanced Wireless Troubleshooting - Cisco Live
Client taking a long time or not responding at all to respond to M1 key sent from ... Clients going to sleep often...
Read more >
Timeouts: Beware Surprisingly High Delay - UCSD CSE
survey dataset and our methods of extracting high latency despite a short timeout in Section 3. Section 4 provides the key results: how...
Read more >
msal-browser - BrowserAuthError: monitor_window_timeout
msal -browser continuously polls the iframe to get the hash content i.e. the error / token / code being returned as a part...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found