stormpath/Turnstile

fatal error: Transfer completed, but there's no current request. NSURLSession

andrew804 opened this issue · 2 comments

When running in Linux with Swift version 3.0.2 after receiving a few requests to my Vapor server (perhaps in quick succession) I get the following fatal error:

fatal error: Transfer completed, but there's no current request.: file Foundation/NSURLSession/NSURLSessionTask.swift, line 794

Thanks to @loganwright I narrowed the problem down to authenticating the incoming request with Turnstile Web. The issue only happens on Linux not macOS but is quite sporadic. The error occurs when Turnstile makes the request to Facebook.

This sounds like a Foundation bug... might want to report it at bugs.swift.org if you can find a way to reproduce it.

Try making requests with this HTTP Client: https://github.com/stormpath/Turnstile/blob/master/Sources/TurnstileWeb/URLSession+Turnstile.swift#L16 and see if you can reproduce the bug independent of Vapor/Turnstile.

Seeing this as well.