possible bug (deadlock) when posting batch request content over a certain length
There seems to be a bug with posting batch request content over a certain length (greater than DEFAULT_PIPE_SIZE = 1024 of PipedInputStream).
Calling graphClient.getBatchRequestBuilder().post(batchRequestContent, null)) goes into a deadlock.
Could you please check this?
Expected behavior
Graph API executes the batch request and returns some kind of response.
Actual behavior
Deadlock in
PipedInputStream.awaitSpace() line: 273 PipedInputStream.receive(byte[], int, int) line: 231 PipedOutputStream.write(byte[], int, int) line: 149 ByteArrayOutputStream.writeTo(OutputStream) line: 167 BatchRequestContent.getBatchRequestContent() line: 177 CustomBatchRequestBuilder(BatchRequestBuilder).toPostRequestInformation(BatchRequestContent) line: 84 CustomBatchRequestBuilder(BatchRequestBuilder).post(BatchRequestContent, Map<String,ParsableFactory<Parsable>>) line: 49 CustomBatchRequestBuilder.post(BatchRequestContent, Map<String,ParsableFactory<Parsable>>) line: 41 ...
when calling
final BatchResponseContent batchResponseContent = Objects.requireNonNull(
graphClient.getBatchRequestBuilder().post(batchRequestContent, null));
Steps to reproduce the behavior
Maven pom.xml
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>6.8.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.12.1</version>
</dependency>
Code:
// Create the batch request content with the steps
final BatchRequestContent batchRequestContent = new BatchRequestContent(
graphClient);
//add some request steps to increase content length
for (int i = 1; i <= 9; i++)
{
// Use the Graph client to generate the requestInformation object for GET /me
final RequestInformation meRequestInformation = graphClient.me()
.toGetRequestInformation();
// Add the requestInformation objects to the batch request content
batchRequestContent
.addBatchRequestStep(meRequestInformation);
}
try
{
// Send the batch request content to the /$batch endpoint
final BatchResponseContent batchResponseContent = Objects.requireNonNull(
graphClient.getBatchRequestBuilder().post(batchRequestContent, null));
System.out.println("response received");
}
catch (IOException e)
{
e.printStackTrace();
}