AzureAD / microsoft-authentication-library-common-for-android

Common code used by both the Active Directory Authentication Library (ADAL) and the Microsoft Authentication Library (MSAL)
MIT License
41 stars 35 forks source link

Setting flights to control UrlConnection timeout values #2473

Closed melissaahn closed 2 months ago

melissaahn commented 2 months ago

Summary

AcquireTokenSilent requests have a default timeout value of 30 seconds, after which a general TimeoutException will be thrown (see this line: https://github.com/AzureAD/microsoft-authentication-library-common-for-android/blob/dev/common4j/src/main/com/microsoft/identity/common/java/controllers/CommandDispatcher.java#L254). To help distinguish some exceptions from the pool of TimeoutExceptions, we can decrease the connect and read timeouts of our HttpUrlConnection instance such that a SocketTimeoutException would get thrown before a general TimeoutException. This PR sets a flight on the default connect and read timeout values for the purpose of gradually introducing lower timeout values and to provide a rollback solution. In telemetry, if this solution is effective, we would expect to see a rise in SocketTimeoutExceptions proportional to a decrease in general TimeoutExceptions.

I tested this flight with ECS dev, enabling the flight to 100% with 15000 ms, and then stopping the flight to mimic a rollback.