Skip to content

Crash accessing URLSessionTask.currentRequest and URLRequest.allHTTPHeaderFields #268

@djtarazona

Description

@djtarazona

I'm fairly consistently getting a crash in NetworkLogger. It looks like Pulse may be accessing URLSessionTask.currentRequest and URLRequest.allHTTPHeaderFields in unsafe ways.

Screenshot 2024-06-24 at 19 51 06 Screenshot 2024-06-24 at 19 30 21

This issue is very similar to one I had with Datadog earlier. It appears URLSessionTask and URLRequest.allHTTPHeaderFields may not be thread-safe. See Datadog's solution for more info.

Reviewing NetworkLogger, it looks like Pulse is accessing URLSessionTask.currentRequest and URLRequest.allHTTPHeaderFields on a background NSManagedObjectContext queue.

Should a solution similar to Datadog's be used? Where the data needed is copied (see ImmutableRequest) before sending to the background queue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions