Comments (10)
did you have a strong reference on the Future
returned by handleRequest
?
from brightfutures.
Sorry to hear you're encountering issues. I can't reproduce the issue myself, it would be helpful if you could provide a crashing test case in a PR if possible.
Could you also try rewriting the method to not use a Promise
(as shown at https://github.com/Thomvis/BrightFutures#providing-futures) to see if the crash still happens?
from brightfutures.
I removed all Promises (there were several, nested). Once I switched to using only futures, the crashes stopped.
from brightfutures.
Glad to hear. Would still love to have a reproducing test case to get this issue fixed, so if you have any insights you can share please do :)
from brightfutures.
I have a project I am working on to do just that. Will post back when I get it in place.
from brightfutures.
We're getting this exact same issue happening after the Swift 5/Xcode 11/BrightFutures 8.0.0 upgrade.
@adjustnox any luck on getting the reproducible project set up?
@Thomvis We tried converting the following block to Futures:
{
private var computeFeedItemsTask:Future<[ContentItemVM], Never>?
// FAILING METHOD
private func computeFeedItems() -> Future<[ContentItemVM], Never> {
...
let existingComputation:Future<[ContentItemVM], Never> = computeFeedItemsTask ?? Future( value: [ContentItemVM]() )
// FAILING LINE
let existingComputationPart:String = (existingComputation.isCompleted) ? "finished" : "in progress...."
...
computeFeedItemsTask = existingComputation.map( computeFeedItemsQueue.context ){ _ /*(_:[FeedItemVM])*/ -> /*Future<*/[ContentItemVM]/*, NoError>*/ in
...
return feedItems
}.onSuccess( DispatchQueue.main.context ){ (feedItems:[ContentItemVM]) in
...
}
}
}
STACK TRACE:
#0 0x0000000112ebf94f in swift_getAssociatedTypeWitnessSlowImpl(swift::MetadataRequest, swift::TargetWitnessTable<swift::InProcess>*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*) ()
#2 0x000000010ee8edaf in AsyncType.isCompleted.getter ()
#3 0x000000010eb491f6 in FeedController.computeFeedItems() at /Users/marchy/Documents/Projects/Happ/Mobile-iOS/Code/Happ.Mobile/Controllers/FeedController.swift:2090
#4 0x000000010eb2c8f5 in FeedController.viewDidLoad() at /Users/marchy/Documents/Projects/Happ/Mobile-iOS/Code/Happ.Mobile/Controllers/FeedController.swift:936
by changing the .map{...}
call above to computeFeedItemsTask = Future { complete in DispatchQueue.global().async { ... }}
as suggested in the docs, but it actually doesn't even run that far, since existingComputation
fails beforehand when trying to access existingComputation.isCompleted
when set with its initial empty array value (Future( value: [ContentItemVM]() )
).
Here's some outputs of the Future's state:
(lldb) po existingComputation
Async<Result<Array<ContentItemVM>, Never>>(Optional(Swift.Result<Swift.Array<Happ_Mobile.ContentItemVM>, Swift.Never>.success([])))
(lldb) po existingComputation.isCompleted
error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x0).
(lldb) po existingComputation.result
▿ Optional<Result<Array<ContentItemVM>, Never>>
▿ some : Result<Array<ContentItemVM>, Never>
- success : 0 elements
Seems pretty wild given the implementation of AsyncType::isCompleted
seems to be simply:
public extension AsyncType {
var isCompleted: Bool {
return result != nil
}
...
}
from brightfutures.
Hi @Thomvis @adjustnox did you guys have a chance to look into this by any chance?
This is preventing us from upgrading to Xcode 11 / Swift 5 / iOS 13.
Any insight would be much appreciated
from brightfutures.
It was a hold up for us as well, so we ended up replacing the promises with escaping closures :/
Can't offer any help, I'm afraid.
from brightfutures.
Sorry that this is still an issue. Still not sure what the root cause could be and why this is not reproducible in a new/simple project.
Can you think of any way in which your projects are similarly special? E.g. what is the install method (CocoaPods, Carthage, etc.)
from brightfutures.
Cocoapods for us.
I can say we had several nested promises, which we switched to futures as per earlier suggestions.
from brightfutures.
Related Issues (20)
- Swift4: build failure HOT 1
- Failed when compiling Bitcode HOT 1
- Promise chaining in BrightFutures using flatMap HOT 3
- Compile error on Xcode 9.3 beta 3 HOT 2
- Swift 4.1 support release HOT 2
- Swift 4.1 Crashes HOT 3
- Generic parameter 'T' could not be inferred HOT 1
- Compile error with XCode 9.3 / Swift 3.3 HOT 1
- Developers in danger!
- Update to Result 4.0.0 (or not) HOT 2
- Conflict with seconds and milliseconds shortcuts HOT 7
- Carthage issue with Result version choosing HOT 2
- Crash app when execute many times Future objects HOT 5
- Synchronous resolution of Futures HOT 2
- High crash rate after upgrade to Xcode 10 HOT 3
- Update to Result -> 4
- Support Swift 5 HOT 2
- 8.0.1 not available on Cocoapods
- No option to throw an error inside map HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brightfutures.