amzn / smoke-framework

A light-weight server-side service framework written in the Swift programming language.
Apache License 2.0
1.44k stars 41 forks source link

Make SmokeInwardsRequestContext thread safe. #105

Closed tachyonics closed 2 years ago

tachyonics commented 2 years ago

Issue #, if available:

Description of changes: Address an issue where parallel service calls within the same server request could cause the application to crash due to mutation of SmokeInwardsRequestContext's internal mutable state from multiple threads. The new implementations in SmokeInwardsRequestContext use a dispatch queue to serialise access to the class' mutable state. The existing methods have been marked as deprecated due to the likelihood that they will not be thread safe.

This is a follow up to https://github.com/amzn/smoke-http/pull/107.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.