NSURLErrorCancelled after seemingly successful transfer?

We are using an URLSessionDataTask to download some JSON from a server and lately we sometimes receive NSURLErrorCancelled (code -999) for no apparent reason.

After enabling CFNetwork Diagnostic Logging I found that in these cases the request finishes with the error mentioned above instead of HTTP/1.1 200 OK even though the response body seems to be transferred in its entirety. What could be causing this? I am pretty certain that it is not us cancelling the task.

NSURLErrorCancelled after seemingly successful transfer?
 
 
Q