apple / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.23k stars 1.12k forks source link

Fix test_webSocket hang #4973

Closed jrflat closed 3 weeks ago

jrflat commented 4 weeks ago

Because the test server sends a close message shortly after sending a pong, the connection might close before our task handles the pong and calls its completion handler. In this case, the pong completion handler is never called, so try await task.sendPing() hangs indefinitely.

This PR cleans up pongCompletionHandlers on error/close and minimally fixes the test to allow the case where the server closes the connection before the pong is handled.

jrflat commented 4 weeks ago

@swift-ci please test