Closed EdwardHinkle closed 6 years ago
What happens if you change the channelResponse.channels.forEach
on line 293 to for channel in channelResponse.channels
? I wonder if there's something going on with the closure operation there.
Thanks! Hmm that was an interesting idea. It actually had the reverse effect.
So the concurrency crash happens in my current code every say 1 in 3, 1 in 4 times. When I changed it for using forIn like that, it actually increased to pretty much every 1 in 2 times.
Completely unscientific numbers, but it definitely was something I had to kind of "trigger" but going back and forth on my view in my current code (the forEach) and it happened very quickly in the forIn. Not sure if that actually tells us anything or is a coincidence :)
Can you post the trace that comes from the crash?
It is also part of a really large method. Any way to break it up?
The other thing that might be worth a shot is to wrap that call in a do-catch block instead of using try? to suppress the resulting error.
Hey, thanks for helping me look into this. On a fluke of another bug, I ended up stumbling on the fix (I think). It seems to be gone now. It looks like it was an issue with my attempt at using caching with the FetchedResultsController. (The fix can be seen here: https://github.com/EdwardHinkle/indigenous-ios/commit/dce07a384b8a246af9eb847a95eaf0a7703c212f)
So I think I'm good just not using caching for now, and I'll look more into caching at a later date.
Thanks again for the help @jsorge!
https://github.com/EdwardHinkle/indigenous-ios/blob/837d4c2402bd0b9b19244a7003e0e475adf0795a/Indigenous/App/Reader/Channel/ChannelViewController.swift#L304
When -com.apple.CoreData.ConcurrencyDebug 1 is set, the line above crashes. This is because apparently that line is somehow breaking concurrency rules. But for the life of me I can't figure out why!! 🙈💀
Maybe it has something to do with this function call? https://github.com/EdwardHinkle/indigenous-ios/blob/837d4c2402bd0b9b19244a7003e0e475adf0795a/Indigenous/App/Reader/Channel/ChannelViewController.swift#L294 It calls to here https://github.com/EdwardHinkle/indigenous-ios/blob/837d4c2402bd0b9b19244a7003e0e475adf0795a/Indigenous/ChannelData.swift#L36
From everything I've been reading about it, I can't find any obvious breaking of concurrency rules. I run the debugger with breakpoints and it seems like everything in that section of code on both sides are on the same thread when I hit each breakpoint.
But I'd love to know if someone experienced looks and this and sees anything obvious that I missed.