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

TestSession failing on Swift 4.0.3 #77

Closed
djones6 opened this issue Jan 24, 2019 · 2 comments
Closed

TestSession failing on Swift 4.0.3 #77

djones6 opened this issue Jan 24, 2019 · 2 comments
Assignees
Milestone

Comments

@djones6
Copy link
Contributor

djones6 commented Jan 24, 2019

Recently, TestSession.testSession has started failing on Swift 4.0.3 (only) with the error:

Fatal error: Dictionary<String, Any> does not conform to Encodable because Any does not 
conform to Encodable.

The stack trace indicates that we are in the process of storing a user profile:

(lldb) bt
* thread #7, name = 'Kitura-Credenti', stop reason = signal SIGILL: illegal instruction operand
  * frame #0: 0x00007ffff74f3830 libswiftCore.so`function signature specialization <preserving fragile attribute, Arg[1] = Exploded> of Swift._assertionFailure(Swift.StaticString, Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 144
    frame #1: 0x00007ffff7383b38 libswiftCore.so`Swift.(assertTypeIsEncodable in _7E218AB453C23F3F79E174A50D84CDB5)<A>(A.Type, in: Any.Type) -> () + 824
    frame #2: 0x00007ffff7385c61 libswiftCore.so`Swift.Dictionary.encode(to: Swift.Encoder) throws -> () + 545
    frame #3: 0x00007ffff7386e0f libswiftCore.so`protocol witness for Swift.Encodable.encode(to: Swift.Encoder) throws -> () in conformance <A, B where A: Swift.Hashable> Swift.Dictionary<A, B> : Swift.Encodable in Swift + 63
    frame #4: 0x00007ffff6e4c5d7 libFoundation.so`Foundation.JSONEncoder.encode<A where A: Swift.Encodable>(A) throws -> Foundation.Data + 727
    frame #5: 0x000000000069a089 Kitura-CredentialsPackageTests.xctest`SessionState.subscript.setter(newValue=<unavailable>, key=<unavailable>, self=<unavailable>) at SessionState.swift:140
    frame #6: 0x00000000004310aa Kitura-CredentialsPackageTests.xctest`static Credentials.store(userProfile=<unavailable>, session=<unavailable>, self=<unavailable>) at Credentials.swift:370
    frame #7: 0x000000000042fd6a Kitura-CredentialsPackageTests.xctest`closure #1 in closure #1 in Credentials.authenticate(userProfile=<unavailable>, session=<unavailable>, request=<unavailable>, successRedirect=<unavailable>, self=<unavailable>, response=<unavailable>, next=<unavailable>) at Credentials.swift:239
    frame #8: 0x00000000004319ed Kitura-CredentialsPackageTests.xctest`partial apply for closure #1 in closure #1 in Credentials.authenticate(credentialsType:successRedirect:failureRedirect:) at Credentials.swift:0
    frame #9: 0x000000000043e2be Kitura-CredentialsPackageTests.xctest`DummySessionPlugin.authenticate(request=<unavailable>, response=<unavailable>, options=<unavailable>, onSuccess=<unavailable>, onFailure=<unavailable>, onPass=<unavailable>, inProgress=<unavailable>, self=<unavailable>) at DummySessionPlugin.swift:56
... etc

Swift 4.0.3 appears to be calling the SessionState subscript setter which takes a Codable when storing the userProfile, whereas Swift 4.2.1 - which passes - calls the setter that takes an Any.

My guess is that the introduction of Kitura/Kitura-Session#54 has caused this failure. This could potentially be a simple test issue but needs investigation.

@Andrew-Lees11
Copy link
Contributor

A a pr has been raised which fixes this issue by removing support for Codable sessions for swift 4.0. This has been tested by raising an issue branch to run Travis which is now passing.
We decided it would be better to remove the new feature over breaking existing builds and once Swift 5 is release we will be dropping support for Swift 4.0 anyway.

@Andrew-Lees11
Copy link
Contributor

Closing since PR has been merged to sessions that fixes this issue

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

2 participants