Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
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

Description

@crackalak

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 = false which gets past the check of an empty stream here:

if (inputStream.CanSeek && inputStream.Length < 1)

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.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions