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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
900
YouTubeへのライブ配信機能をリリースするまで
yurihondo
0
3.2k
Shibuya.apk_41_DeepDiveintoRememberSaveable.pdf
yurihondo
0
510
Composeでシステムオーバーレイ / System overlay in Compose
yurihondo
0
400
Service由来のViewでViewModelを使えるようにしてみた
yurihondo
2
830
瀕死のシステムが強くなって復活する話
yurihondo
1
540
New UI Design & Debugging Tools In Android Studio
yurihondo
0
770
外部デバイスと密に連携するAndroidアプリに最適なアーキテクチャとは?
yurihondo
0
14k
Other Decks in Programming
See All in Programming
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
330
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
0
120
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
250
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
110
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
330
LLM 101
dalinaum
0
440
オーケストレーション記述言語 Katari
yukikurage
0
220
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
250
SODA - FACT BOOK(EN)
sodainc
1
200
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
210
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.9k
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.5k
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
990
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
960
Context Engineering - Making Every Token Count
addyosmani
9
1.3k
Fireside Chat
paigeccino
43
4.1k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
470
Evolving SEO for Evolving Search Engines
ryanjones
0
350
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
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