Skip to content

AutoRestBaseUrl is not thread safe, causes failures in concurrent applications #776

Description

@begoldsm

The runtime implementation of AutoRestBaseUrl for retrieval of the URL is not thread safe, since it results in the iteration on and clearing of a hashmap without putting the iterate and clear in a critical section. This manifests itself specifically in the scenario where someone is using a custom BaseUrl template and running a parallel application (say, create multiple files in ADLS in parallel).

From the customer who encountered this issue:
The exception is coming from the line where it is looping over the entryset:

for (Map.Entry<CharSequence, String> entry : mappings.entrySet()) {

Right after that loop it calls mappings.clear() so if the RequestFactory is shared by multiple threads (which I think it is), then one thread could be iterating over the set, which another calls mappings.clear().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions