I am having a hard time attempting to use Swift in a production app on Windows!
It turns out if your URLSessionTask
fails due to a timeout, instead of completing with an error I instead get a total crash.
I thought I'd see if I can use something that's a little more bare-metal like async-http-client only to realize there are some major blockers keeping it from building for Windows (mostly swift-nio issues).
Currently there is no pure-Swift way of making a web request guaranteed to not crash on Windows.
In my case, if a user blocks network access of my Swift-backed Windows software through a 3rd party tool or if my server times out for any reason, the crash happens.
Relevant GitHub Issue: [SR-13383] Windows, Dispatch crashes after network request timeout · Issue #609 · apple/swift-corelibs-libdispatch · GitHub
PR with "dubious" fix: Don't crash due to closed socket on Windows by triplef · Pull Request #772 · apple/swift-corelibs-libdispatch · GitHub
P.S. I also get a similar full crash and burn upon attempting to cancel()
a URLSessionTask
of any kind on Windows...