vapor / core

🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging.
MIT License
82 stars 50 forks source link

Fix synchronization issue in QueueHandler #118

Closed jseibert closed 6 years ago

jseibert commented 6 years ago

In the event that the current promise triggers another Channel operation serviced by this QueueHandler, channelRead() becomes re-entrant, and crashes with an assertion failure because the last callback in the queue is called twice, and then removed twice.

Instead, tidy up and remove the last handler before satisfying the promise.

tanner0101 commented 6 years ago

@jseibert will merge this for 3.0.2, but is there any way you could provide a snippet to recreate the error? I would like to include that in a unit test somewhere so that we can make sure there are no regressions.