When using ms graph sdks, is there a way to configure the api timeouts and retries for ms graph api calls, or how to read those setting.

Ajay Kawde 0 Reputation points
2024-06-20T08:16:43.01+00:00

We are using ms graph sdks to fetch emails from 0365 mailboxes, we have observed that the service is stopping its execution when the number of emails are high.

this is the api call which sometimes takes more than 5000 ms , so we assume the thread is hung for this time interval.

https://graph.microsoft.com/v1.0/users/mailbox/mailFolders/inbox/messages?$select=id,isRead,subject,sentDateTime,receivedDateTime,sender,toRecipients,ccRecipients,bccRecipients,replyTo,body&$filter=isRead ne true&$orderby=receivedDateTime asc&$top=20&$expand=attachments($select=id),singleValueExtendedProperties($filter=id eq 'Long 0xe08')

We have created a thread dump and observed many threads were hung due to the msgraph api calls were taking longer time to complete.

Below are some stackstrace for hungThreeads

stackTrace:

  • sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
  • java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=175 (Compiled frame)
  • java.util.concurrent.CompletableFuture$Signaller.block() @bci=19, line=1707 (Compiled frame)
  • java.util.concurrent.ForkJoinPool.managedBlock(java.util.concurrent.ForkJoinPool$ManagedBlocker) @bci=119, line=3323 (Compiled frame)
  • java.util.concurrent.CompletableFuture.waitingGet(boolean) @bci=115, line=1742 (Compiled frame)
  • java.util.concurrent.CompletableFuture.get() @bci=11, line=1908 (Compiled frame)
  • com.microsoft.graph.httpcore.AuthenticationHandler.intercept(okhttp3.Interceptor$Chain) @bci=68, line=55 (Compiled frame)
  • okhttp3.internal.http.RealInterceptorChain.proceed(okhttp3.Request) @bci=297, line=109 (Compiled frame)
  • com.microsoft.graph.httpcore.RedirectHandler.intercept(okhttp3.Interceptor$Chain) @bci=83, line=137 (Compiled frame)
  • okhttp3.internal.http.RealInterceptorChain.proceed(okhttp3.Request) @bci=297, line=109 (Compiled frame)
  • com.microsoft.graph.httpcore.RetryHandler.intercept(okhttp3.Interceptor$Chain) @bci=50, line=176 (Compiled frame)
  • okhttp3.internal.http.RealInterceptorChain.proceed(okhttp3.Request) @bci=297, line=109 (Compiled frame)
  • com.microsoft.graph.httpcore.TelemetryHandler.intercept(okhttp3.Interceptor$Chain) @bci=207, line=69 (Compiled frame)
  • okhttp3.internal.http.RealInterceptorChain.proceed(okhttp3.Request) @bci=297, line=109 (Compiled frame)
  • okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp() @bci=253, line=201 (Compiled frame)
  • okhttp3.internal.connection.RealCall.execute() @bci=63, line=154 (Compiled frame)
  • com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(com.microsoft.graph.http.IHttpRequest, java.lang.Class, java.lang.Object, com.microsoft.graph.http.IStatefulResponseHandler) @bci=18, line=397 (Compiled frame)
  • com.microsoft.graph.http.CoreHttpProvider.send(com.microsoft.graph.http.IHttpRequest, java.lang.Class, java.lang.Object, com.microsoft.graph.http.IStatefulResponseHandler) @bci=20, line=220 (Compiled frame)
  • com.microsoft.graph.http.CoreHttpProvider.send(com.microsoft.graph.http.IHttpRequest, java.lang.Class, java.lang.Object) @bci=19, line=197 (Compiled frame)
  • com.microsoft.graph.http.BaseCollectionRequest.send() @bci=28, line=102 (Compiled frame)
  • com.microsoft.graph.http.BaseEntityCollectionRequest.get() @bci=2, line=78 (Compiled frame)

We want to know if there is any way we can configure the timeouts so the threads are not hung for a longer period of time.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,428 questions
0 comments No comments
{count} votes