Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Behavior of nested async in Kotlin Coroutines
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
yurihondo
December 18, 2018
Programming
1.2k
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
230
Road to Single Activity
yurihondo
2
860
YouTubeへのライブ配信機能をリリースするまで
yurihondo
0
3k
Shibuya.apk_41_DeepDiveintoRememberSaveable.pdf
yurihondo
0
500
Composeでシステムオーバーレイ / System overlay in Compose
yurihondo
0
380
Service由来のViewでViewModelを使えるようにしてみた
yurihondo
2
810
瀕死のシステムが強くなって復活する話
yurihondo
1
540
New UI Design & Debugging Tools In Android Studio
yurihondo
0
750
外部デバイスと密に連携するAndroidアプリに最適なアーキテクチャとは?
yurihondo
0
14k
Other Decks in Programming
See All in Programming
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
Webフレームワークの ベンチマークについて
yusukebe
0
180
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
180
エージェンティックRAGにAWSで入門しよう!
har1101
9
1.7k
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
390
Contextとはなにか
chiroruxx
1
370
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
350k
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
12
6.4k
Claspは野良GASの夢をみるか
takter00
0
210
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
210
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
180
はてなアカウント基盤 State of the Union
cockscomb
0
620
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Mobile First: as difficult as doing things right
swwweet
225
10k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
210
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
470
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
66
55k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
A Tale of Four Properties
chriscoyier
163
24k
The browser strikes back
jonoalderson
0
1.3k
How to build a perfect <img>
jonoalderson
1
5.7k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.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