We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
md5: fb2a181801db3c18819818030ea60af6
Issue Description:
Application crashes with the following Fatal error :
Fatal error: Trying to remove task, but it's not in the registry.: file /swift-corelibs-foundation/Foundation/URLSession/TaskRegistry.swift, line 76
// Recreate import XCTest import Kitura import Foundationfinal class dataTaskTests: XCTestCase { let router = Router() func testExample() throws { router.get("/", handler: getHandler) Kitura.addHTTPServer(onPort: 8080, with: router) Kitura.start() let expectation1 = expectation(description: "A unauthorized response is received from the server -> .unauthorized") let request = URLRequest(url: URL(string: "http://localhost:8080/")!) let session = URLSession(configuration: URLSessionConfiguration.default) let task = session.dataTask(with: request) { (data, response, error) in print("session.dataTask: \(String(describing: response?.description))") guard error == nil, let response = response as? HTTPURLResponse else { print("Error returned: \(String(describing: error?.localizedDescription))") return XCTFail("Error connecting returned") } let code = response.statusCode if code >= 200 && code < 300 { print("Success code") return XCTFail() } else { print("Failure code") expectation1.fulfill() } } task.resume() waitForExpectations(timeout: 3.0, handler: nil) Kitura.stop() } func getHandler(completion: ([String]?, RequestError?) -> Void) { completion(nil, .unauthorized) } static var allTests = [ ("testExample", testExample), ] }
The text was updated successfully, but these errors were encountered:
Comment by sai Hema k (JIRA)
The failure is due to the invocation of the Taskregistry.remove twice when the response code is not equal to 401.
Sorry, something went wrong.
Comment by Ian Partridge (JIRA)
#2061
No branches or pull requests
Additional Detail from JIRA
md5: fb2a181801db3c18819818030ea60af6
Issue Description:
Application crashes with the following Fatal error :
Fatal error: Trying to remove task, but it's not in the registry.: file /swift-corelibs-foundation/Foundation/URLSession/TaskRegistry.swift, line 76
The text was updated successfully, but these errors were encountered: