Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

iOS 11 Crashes - Invalid State Transformation while Evaluating Conditions #17

Open
biocross opened this issue Aug 22, 2017 · 11 comments
Open
Labels

Comments

@biocross
Copy link

Overdrive: 0.3
Package manager (SPM, Carthage, CocoaPods, Manual): CocoaPods
Xcode: 9.0 beta 6
Platform: iOS

The dependency system seems to be failing in iOS 11. I have tried this with Xcode 9 betas 6 & 7 (latest right now). Quite a few tests are failing, especially an assertion failure TaskConditionTests, which seems to be the most severe, which actually is affecting our production users on iOS betas with crashes.

@saidsikira
Copy link
Owner

saidsikira commented Aug 22, 2017 via email

@biocross
Copy link
Author

biocross commented Aug 23, 2017

I have gotten around this temporarily by replacing
assert(internalState.canTransition(to: newState, isCancelled: isCancelled), "Invalid state transformation from \(internalState) to \(newState)") internalState = newState

with

if(internalState.canTransition(to: newState, isCancelled: isCancelled)){ internalState = newState }

in TaskBase.swift (state variable setter)

For the time being, this fixes the crashes, as well passes the tests on the iOS 11 simulator. This is basically preventing invalid state transformations.

@biocross
Copy link
Author

Hey, could you get the time to look at this?

@saidsikira
Copy link
Owner

saidsikira commented Aug 25, 2017 via email

@saidsikira
Copy link
Owner

@biocross you say that you've ran unit tests on Xcode 9 beta, does that mean that you converted project to Swift 4? I'm currently running tests on Xcode 9 and every test is passing. If you're interested in that you can look into swift4 branch of the repo.

However, you have a problem in production with iOS 11. Could you supply me with a piece of code that can showcase problems you're having? Then, I'll be able to investigate more.

@biocross
Copy link
Author

I didn't convert the code to Swift 4. Basically, due to evaluateConditions being called twice on tasks, the task is moving to the ready state twice, leading to an assertion failure in TaskBase.swift, and crashing in debug. In release mode, even if the assertion is disabled, invalid state transformation end up crashing my tasks.

@biocross
Copy link
Author

Hey one thing, tests pass for me in Xcode 9, if I target my mac. Did you target an iOS 11 simulator to run the tests?

@biocross
Copy link
Author

Hey, any update?

@saidsikira
Copy link
Owner

I have confirmed that there is a different behavior between iOS 10 and iOS 11, still trying to figure out why. I should have a fix by the end of the day.

@saidsikira
Copy link
Owner

Looks like the behavior of several KVO methods is slightly changed in iOS 11. For now, you can try out fix in the conditions-fix branch.

It's mostly a hack until I rewrite some of the internal stuff, but it should work.

Let me know if it works for you.

@biocross
Copy link
Author

biocross commented Sep 1, 2017

Alright. Thanks a lot! Seems to work, considering the tests pass.

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

No branches or pull requests

2 participants