httpswift / swifter

Tiny http server engine written in Swift programming language.
BSD 3-Clause "New" or "Revised" License
3.9k stars 539 forks source link

fix(queue): moved socket iteration into queue #538

Open sim-ceridian opened 1 year ago

sim-ceridian commented 1 year ago

We have been experiencing issues with random test failure in Swifter's unit tests. Particularly testStopWithActiveConnections in IOSafetyTests

Swifter Test Failure

We believe this is due to stop() iterating through available sockets while they are potentially mutated by the global queue dispatch in start(). This PR moves the loop over sockets into the private queue to ensure that access is gated. It appears to fix our random failures with unit tests (so far 🤞)