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.

(400) Bad Request - The specified block list is invalid. ErrorCode:InvalidBlockList

See original GitHub issue

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the SDK was used?

WindowsAzure.Storage 6.2.0

Which platform are you using? (ex: .NET Core 2.1)

.Net Framework 4.5.1

What problem was encountered?

Getting this 400 Bad Request with message in transient fashion randomly.

The specified block list is invalid. 

ErrorCode: InvalidBlockList

API being used:

public virtual void UploadFromByteArray(byte[] buffer, int index, int count, AccessCondition accessCondition = null, BlobRequestOptions options = null, OperationContext operationContext = null);

How can we reproduce the problem in the simplest way?

Execute this scenario and run multiple times with different threads uploading together 100MB or so type of data.

Have you found a mitigation/solution?

Not Yet

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:37 (11 by maintainers)

github_iconTop GitHub Comments

10reactions
moroz-slavomircommented, Dec 9, 2020

We are also facing the same issue and have done a little bit of an investigation in the application insights. Here is what we have found.

Trivia

The Put Block operation creates a new block to be committed as part of a blob. image

The Put Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. image

Successful upload

Consists of 1-n Put Block operations and final Put Block List operation. image

Failed upload

In the failed upload the final Put Block List fails with message The specified block list is invalid. image

Possible cause

It seems that storage SDK is executing the Put Block List in parallel with the Put Block and does not wait for the Put Block to finish.

Successful upload timeline Upload #1 - 1 block image 2020-12-07T12:53:09.8442922Z + 0.01 2020-12-07T12:53:09.854617Z

Upload #2 - many blocks image 2020-12-07T13:17:51.3556283Z + 0.371 2020-12-07T13:17:51.7276951Z

Failed upload timeline Upload #3 - 2 blocks image 2020-11-27T13:27:44.3833279Z + 0.03 2020-11-27T13:27:44.3835717Z

Upload #4 - 2 blocks image 2020-11-27T13:38:11.1370163Z + 0.105 2020-11-27T13:38:11.1372083Z

We are also using OpenWriteAsync() as was @angelcalvasp in their example, so my guess is the problem lies in the BlobWriteStream.

CommitAsync is calling PutBlockListAsync (the final operation) and before that it runs FlushAsync. It appears the FlushAsync should block until all pending block writes are finished, but I guess it doesn’t work properly.

Edited: SDK Version: 11.2.2 Platform: .Net Framework 4.7.2

4reactions
kasobol-msftcommented, Apr 15, 2021

The fix is available on Nuget. Version 11.2.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting InvalidBlock 'The specified block list is ...
This can occur if the application / client specify a block size that is not supported. Reference link for the Put Block REST...
Read more >
"The specified block list is invalid" while uploading blobs in ...
The specified block list is invalid. System. Net. WebException: The remote server returned an error: (400) Bad Request.
Read more >
The specified block list is invalid. ErrorCode:InvalidBlockList
Javascript Required. · (400) Bad Request - The specified block list is invalid. · Which service(blob, file, queue, table) does this issue concern?...
Read more >
Dealing With “The specified blob or block content is invalid ...
If you're uploading blobs by splitting blobs into blocks and you get the error – The specified blob or block content is invalid,...
Read more >
Untitled
The specified block list is invalid Put Block List (REST API) - Azure Storage Microsoft Learn ... the request will fail with status...
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