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

CI failure with Swift 5 #45

Closed
djones6 opened this issue Jan 9, 2019 · 8 comments
Closed

CI failure with Swift 5 #45

djones6 opened this issue Jan 9, 2019 · 8 comments
Assignees
Milestone

Comments

@djones6
Copy link
Contributor

djones6 commented Jan 9, 2019

#42 aims to add Swift 5 testing to the CI, but one of the tests fails on Linux with:

/home/travis/build/IBM-Swift/KituraKit/Tests/KituraKitTests/BasicAuthTests.swift:90: error: BasicAuthTests.testBasicAuthUnauthorized : XCTAssertEqual failed: ("601 : A connection error occurred, cannot connect to the server. Please ensure that the server is started and running, with the correct port and URL ('ToDoServer' if using the sample app).") is not equal to ("401 : Unauthorized") -
Fatal error: Trying to remove task, but it's not in the registry.: file /home/buildnode/jenkins/workspace/oss-swift-5.0-package-linux-ubuntu-16_04/swift-corelibs-foundation/Foundation/URLSession/TaskRegistry.swift, line 76
/home/travis/build/IBM-Swift/KituraKit/Tests/KituraKitTests/BasicAuthTests.swift:91: error: BasicAuthTests.testBasicAuthUnauthorized : API violation - multiple calls made to XCTestExpectation.fulfill() for A response is received from the server -> .unauthorized.
Exited with signal code 4

This needs investigation.

@djones6
Copy link
Contributor Author

djones6 commented Apr 1, 2019

@Andrew-Lees11 could you document the double invocation of the callback you found from URLSession.dataTask when Kitura sends a 401: Unauthorized response? And also link to the StackOverflow issue you found which is likely to be the same / related to this.

I wonder if this is somehow related to swiftlang/swift-corelibs-foundation#1569 - in which case maybe @saiHemak could investigate?

@Andrew-Lees11
Copy link
Contributor

I created a gist that would recreate the test failure here.

When a Kitura server returns a 401 unauthorized code the callback on URLSession.dataTask is called twice. once with "The operation could not be completed" and then with the response from Kitura. This is not true for other error codes and only happens on Swift 5 on Linux.

I think This Stackoverflow error May be running into the same problem since it is only failing on Linux but i'm not entirely sure.

@djones6 djones6 added this to the 2019.07 milestone Apr 2, 2019
@saiHemak
Copy link

saiHemak commented Apr 3, 2019

Could successfully recreate the issue from TestFoundation. Upon instrumenting the code I could see the TaskRegistry.remove is getting called twice . Instrumenting further to identify why the remove call has been triggered twice ..

@pushkarnk
Copy link

@saiHemak this seems to be reported over Twitter too https://twitter.com/mxcl/status/1111073495017029635

@saiHemak
Copy link

saiHemak commented Apr 3, 2019

session.taskRegistry.remove(task) has been called twice once from urlProtocol(`protocol`, didFailWithError: urlError) and the from the switch case case .dataCompletionHandler(let completion):

@saiHemak
Copy link

saiHemak commented Apr 3, 2019

created PR swiftlang/swift-corelibs-foundation#2061

@saiHemak saiHemak closed this as completed Apr 5, 2019
@ianpartridge
Copy link
Contributor

Please open an issue to track re-enabling these tests once Swift 5.0.1 ships with the fix.

@Andrew-Lees11
Copy link
Contributor

Raised an issue to uncomment the tests here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants