Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Behavior of nested async in Kotlin Coroutines
Search
yurihondo
December 18, 2018
Programming
1.3k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Behavior of nested async in Kotlin Coroutines
yurihondo
December 18, 2018
More Decks by yurihondo
See All by yurihondo
Road to Single Activity Uncovered
yurihondo
0
240
Road to Single Activity
yurihondo
2
890
YouTubeへのライブ配信機能をリリースするまで
yurihondo
0
3.2k
Shibuya.apk_41_DeepDiveintoRememberSaveable.pdf
yurihondo
0
500
Composeでシステムオーバーレイ / System overlay in Compose
yurihondo
0
400
Service由来のViewでViewModelを使えるようにしてみた
yurihondo
2
820
瀕死のシステムが強くなって復活する話
yurihondo
1
540
New UI Design & Debugging Tools In Android Studio
yurihondo
0
760
外部デバイスと密に連携するAndroidアプリに最適なアーキテクチャとは?
yurihondo
0
14k
Other Decks in Programming
See All in Programming
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
750
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
160
dotNET_vulnclicker_intro.pdf
deka_morita
0
130
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Agents on Rails - Rails at Scale 2026
irinanazarova
0
520
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5k
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
450
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
200
すこし踏み込む CancellationToken
htkym
2
1.7k
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
130
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.5k
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
100
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
Believing is Seeing
oripsolob
1
240
So, you think you're a good person
axbom
PRO
2
2.2k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
610
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
How to Talk to Developers About Accessibility
jct
2
570
Why Our Code Smells
bkeepers
PRO
340
58k
Site-Speed That Sticks
csswizardry
13
1.6k
Transcript
Behavior of nested async in Kotlin Coroutines
About me Androidアプリ開発@DeNA 趣味は、ストリートダンス 今年、長男が爆誕 2 URI 本戸 裕理 (ホンド
ユウリ)
Introduction 今更ですが! Kotlin 1.3より、Coroutineの安定版が 利用できるようになりました 3
Introduction 私が携わるプロジェクトでもCoroutineの アップデートが 行われました 4
Introduction 結果、 アップデート起因のバグを埋め込み、 修正をする事になりました 5
Introduction そう、 あるあるです 6
Introduction (流出はしていません) 一応、最近センシティブだからね 7
Introduction 今日は、バグ対応から学んだ ◦ ネストしたasyncの振舞いと対応方法 について簡単にお話させて頂きます 8
ネストしたasyncの振舞いと対応方法 9
ver. 0.30.0より、ネストしたasyncのキャンセルが、 親のcoroutineにも伝播するようになったため、 今までエラーハンドリングを意識していなかった 箇所で例外が発生した 該当のFeature <https://github.com/Kotlin/kotlinx.coroutines/releases/tag/0.30.0> Overview for Bug
10
例えば、 以下のようなケースで例外が発生するようになった Example 11
例外が親のlaunchにも伝播する Example 12 Exception
Solution 1 withContextを利用 13
Solution 2 スコープを切り替える 14
今回の例であれば、launchにCoroutineExceptionHandler を渡して ネストされたのCoroutineのエラーをまとめてしまう Solution 3 例外の集約 15
※以下は、supervisorScopeの例 Solution 4 Supervisionを導入 16
まとめ 17 これからネスト状態でasyncを扱うときは... 1. withContextを使う 2. Suspend関数に切り出す 3. 例外の集約 4.
Supervisionの導入 辺りを検討できると良いかも...そして...
まとめ 18 Release Note は、しっかり読みましょう!!! (自戒)
Reference 今回の発表の不明点は、以下でほぼ解消されます 19 ◦ Kotlin Coroutines 0.30.2のExceptionが伝わる仕組み <https://qiita.com/takahirom/items/2846caa1d51e868ef88b> ◦ Kotlin
Coroutine 1.0.0までに夏から変わったところ <http://sys1yagi.hatenablog.com/entry/2018/12/08/181232>
THANKS! You can find me at: Twitter : URI -
@yuyuyuyuyuri Pokemon GO : 05URI28 - 0188 7196 1789 20