-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Narrowing down cause of ChildCancelledException
with no stack trace
#2550
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
Comments
Yes. This property indeed should be set prior to any coroutines initialization.
Unfortunately, no public API. Filed #2551. As a hacky way, you can try using
Hard to tell without actually checking all the code and tests, but indeed these calls look pretty suspicious. We are likely to deprecate
The best way is to enable a debug mode. The exception is thrown from
No, because |
Also, could you please elaborate on the following:
|
We were able to reproduce this in a debug build and get a call stack! The crash was indeed from using a
So, the crash itself is expected behavior. However, I’m still working on getting debug mode enabled in our release builds:
That snippet always returns false for me, but it got me on the right track. I modified it like this:
This works in debug builds - returns
This may be the culprit. Is that config applied to all Proguard-using Android coroutines projects by default? Should adding this to my proguard.cfg file be enough to override it?
I tried making a release build with that modified config, but |
Glad you've found the root cause!
Unfortunately, I'm not well-experienced in a proguard, so it's worth asking it in an Android-specific community. Closing as "resolved", please stay tuned for #974! |
(cherry picked from commit 505ba3c)
I’m working on an Android feature using coroutines 1.4.2 that involves many complex flows using
combine
,flatMapLatest
,stateIn
, etc.I'm getting reports of production crashes that are missing stack traces:
This sounds similar to several other issues caused by
Channel.offer
throwing (#974, #1433, #2104). However, I already have these error-handling wrappers around everyoffer
andsendBlocking
call in my application code:I’ve been unable to reproduce this locally, so without a stack trace, I am unsure how to proceed. I know this report is way too vague to be actionable for you either (sorry!), but am hoping you may have tips for narrowing it down more.
Questions:
I am already calling
System.setProperty(DEBUG_PROPERTY_NAME, DEBUG_PROPERTY_VALUE_ON)
fairly early in application startup.What is the best way to catch these
ChildCancelledExceptions
exceptions manually while preserving as much info as possible about their source? If they are indeed coming from anoffer
-after-cancellation somewhere, would you expect them to be catchable withFlow.catch
downstream, even though normal cancellation exceptions are not?I’ve noticed unguarded
offer
calls in a couple of pieces of third-party code I’m using. Do these look capable of causing this sort of crash when used insideflatMapLatest
etc?createFlow
functionLiveData.asFlow
functionThank you!
The text was updated successfully, but these errors were encountered: