Replies: 19 comments 23 replies
-
Sorry about that!
Can you explain this a bit more? Changing back to |
Beta Was this translation helpful? Give feedback.
-
I'm not 100% sure that this code a38e04d#diff-52e8a72d908dc1b0d23451f4b256d0244f27c6361facaa5cf73a026f315c25df is the issue but when the app crash it stop there and there is modification here between the 0.23.0 and the 0.24.0. When I do compare both 0.23.0...0.24.0 I don't see what else could cause that crash. What can I do to help? This is just before the crash |
Beta Was this translation helpful? Give feedback.
-
After bisecting for some time, I found out that my app was crash on every version for the last two months. But the archived version on TestFlight where working, the difference was the dependencies then. So I did retry to bisect and change TCA to a fixed version(0.23.0) and the app stopped crashing. |
Beta Was this translation helpful? Give feedback.
-
Looks like the case of running out of stack space, judging by |
Beta Was this translation helpful? Give feedback.
-
Export of the thread and the variable with TCA 0.23.0
|
Beta Was this translation helpful? Give feedback.
-
Call me crazy, maybe the change you're referring to @mackoj is adding an additional copy (
|
Beta Was this translation helpful? Give feedback.
-
Thanks, for responding. |
Beta Was this translation helpful? Give feedback.
-
Great catch @andreyz for sure this a38e04d#diff-52e8a72d908dc1b0d23451f4b256d0244f27c6361facaa5cf73a026f315c25df (diff of ViewStore between 0.23 and 0.24) show the copy of the app state. And create the crash 😆 |
Beta Was this translation helpful? Give feedback.
-
@mackoj I was a little suspicious of the above change from |
Beta Was this translation helpful? Give feedback.
-
I do think that revert the |
Beta Was this translation helpful? Give feedback.
-
StackOverflow crashes are the worst to spot. Usually EXC_BAD_ACCESS, code=2 with non-nil addresses at random places where it can't crash. |
Beta Was this translation helpful? Give feedback.
-
I can solve it this way but I do think that AppState should be on the heap(stephencelis was the first to talk about this). It did happen to me on various occasions and be face with this issue and each time it's pretty time-consuming. Find the root cause and the conclusion has often been removed feature or add We cannot rely on the hard limit imposed by the OS since our AppState could go over them so easily. What do you think? @tgrapperon @andreyz FWIW I have a hard time foresee what issue putting AppState on the heap could bring. |
Beta Was this translation helpful? Give feedback.
-
It's an ongoing issue with Swift that switches paradigms. The runtime hasn't caught up yet and 512kB is often too small, I agree. I think it should be around 5-10MB, like it is on macOS, especially with the new concurrency model that will limit the number of threads. However, if you're using a Anecdotally, this is not proper to TCA. I had this kind of issue in my vanilla UIKit app where I have a value with many nested value fields. I had to turn the whole thing into a class because I still had the issue when extracting parts to pass to functions. Now that we have property-wrappers in function's arguments, I would try to push the |
Beta Was this translation helpful? Give feedback.
-
I'm going to convert this to a discussion so that it's easier for us to thread messages because there's a lot to discuss here. |
Beta Was this translation helpful? Give feedback.
-
A bit more context informations the AppState is 20 KB func bytesFormater(bytes: Int) -> String {
let bf = ByteCountFormatter()
bf.allowedUnits = .useAll
bf.countStyle = .file
bf.includesUnit = true
bf.isAdaptive = true
return bf.string(fromByteCount: Int64(bytes))
}
print("💾 AppState size: \(bytesFormater(bytes: MemoryLayout<AppState>.size))") |
Beta Was this translation helpful? Give feedback.
-
I’ve been seeing this crash too trying to upgrade our app from 0.23 to 0.25. It instantly started crashing on launch. However, we have some threading issues in our app - a legacy queue based effects system was accessing our TCA store concurrently from background threads and of course TCA isn’t thread safe. Fortunately we rarely saw memory related crashes until I attempted this upgrade. I’ve gone down the route of eliminating all cross thread store access so we only access the store from the main queue and the problem seems to have gone away. I don’t know why this change seemed to make it more prone to crashing when accessing across threads though. Are you sure you are only accessing the TCA store from a single thread? |
Beta Was this translation helpful? Give feedback.
-
We just started testing our app in iOS 16 and these stack overflow seem to happen all the time. |
Beta Was this translation helpful? Give feedback.
-
As it seems to be an ongoing issue, I've drafted a few diagnostic tools this morning. Disclaimer: I'm not a specialist with low-level things, so please consider them with a pinch of salt.
|
Beta Was this translation helpful? Give feedback.
-
Our team is also facing the same issue and I just stumbled upon this bit of documentation that explains how to increase stack size (credit to this StackOverflow (which name is on point in this context ^^))
It seemed a bit too good to be true but it appears to work according to my first tests using @tgrapperon nice utility above. Stack size apparently went from 1032192 to 16777216 when running on iPhone 11, iOS 15.5. It feels like a quick patch but it will give us some air until we can solve this in a more futureproof manner ;) |
Beta Was this translation helpful? Give feedback.
-
Hi,
Describe the bug
Since this modification my app crash on device all the time on startup here.
I had to revert to an old version of TCA(0.23.0) to prevent the bug.
Thread 1: EXC_BAD_ACCESS (code=2, address=0x16f8a7ff8)
Environment
Additional context
I did revert a38e04d#diff-52e8a72d908dc1b0d23451f4b256d0244f27c6361facaa5cf73a026f315c25df to
.send($0)
in the 0.25.1 and it's not working 🤣.Beta Was this translation helpful? Give feedback.
All reactions