immobiliare / RealHTTP

🌀swift async http client - fast, lightweight, type-safe
MIT License
282 stars 28 forks source link

Concurrent access to HTTPDataLoader causes crash of the lib #45

Closed malcommac closed 2 years ago

malcommac commented 2 years ago

When multiple calls attempt to modify from different threads the inner structure inside the HTTPDataLoader where the running tasks are maintained, the result is a crash, usually as EXC_BAD_ACCESS.

This PR fixes the bug by adding exclusive access to write the data at the beginning and when a request completes.