You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
XmlException causing performance hit when checking the existance of a non-existant directory #835
Which service(blob, file, queue, table) does this issue concern?
File
Which version of the SDK was used?
9.4.2
Which platform are you using? (ex: .NET Core 2.1)
.NET Core 2.1
What problem was encountered?
XmlException is thrown, and silently handled, when checking if a non-existant directory exists with Exists/ExistsAsync(), this affects performance (~+200ms).
How can we reproduce the problem in the simplest way?
HttpClient returns a Stream of value EmptyReadStream when it receives an empty response body, this Stream has CanSeek = false which gets past the check of an empty stream here:
Changing the line to: if (!inputStream.CanSeek || inputStream.Length < 1)
Means that the XmlException isn't raised when trying to read from the empty stream, and performance is restored to what it should be.
While this fixes the issue, I'm not sure if this would affect anything else (it doesn't from what I can see) or if it is how you would want to go about solving it.
Which service(blob, file, queue, table) does this issue concern?
File
Which version of the SDK was used?
9.4.2
Which platform are you using? (ex: .NET Core 2.1)
.NET Core 2.1
What problem was encountered?
XmlException is thrown, and silently handled, when checking if a non-existant directory exists with Exists/ExistsAsync(), this affects performance (~+200ms).
How can we reproduce the problem in the simplest way?
Gist
Have you found a mitigation/solution?
HttpClient returns a Stream of value EmptyReadStream when it receives an empty response body, this Stream has
CanSeek = falsewhich gets past the check of an empty stream here:azure-storage-net/Lib/Common/StorageExtendedErrorInformation.cs
Line 120 in 8c42657
Changing the line to:
if (!inputStream.CanSeek || inputStream.Length < 1)Means that the XmlException isn't raised when trying to read from the empty stream, and performance is restored to what it should be.
While this fixes the issue, I'm not sure if this would affect anything else (it doesn't from what I can see) or if it is how you would want to go about solving it.