Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12336] Difference in Behavior between Foundation and FoundationNetworking #3265

Closed
SlaunchaMan opened this issue Mar 9, 2020 · 1 comment
Assignees

Comments

@SlaunchaMan
Copy link

Previous ID SR-12336
Radar None
Original Reporter @SlaunchaMan
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 18.04

Additional Detail from JIRA
Votes 1
Component/s Foundation
Labels Bug
Assignee @spevans
Priority Medium

md5: 54f8025b802f5e2507b1d65023c4a0c0

Issue Description:

In Foundation on Apple platforms, this code works fine:

import Foundation

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

let task = URLSession.shared
    .dataTask(with: URL(string: "http://www.example.com")!) { data, response, error in
        print("got it")
        exit(EXIT_SUCCESS)
}
    
task.resume()
task.resume()

dispatchMain()

On Linux, however, this causes the following crash:

Fatal error: Resuming a task that's not suspended. Calls to resume() / suspend() need to be matched.: file /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-18_04/swift-corelibs-foundation/Foundation/URLSession/URLSessionTask.swift, line 420

This difference causes a crash building the test suite for Alamofire on Linux: Alamofire/Alamofire#3098

@spevans
Copy link
Collaborator

spevans commented Mar 16, 2020

#2733

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants