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
goleak で goroutine leak を検出する
Search
kumatch
January 25, 2020
Programming
0
510
goleak で goroutine leak を検出する
kumatch
January 25, 2020
Tweet
Share
More Decks by kumatch
See All by kumatch
umedago-20190726.pdf
kumatch
0
58
Other Decks in Programming
See All in Programming
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
760
NPOでのDevinの活用
codeforeveryone
0
840
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
130
Deep Dive into ~/.claude/projects
hiragram
14
2.6k
Is Xcode slowly dying out in 2025?
uetyo
1
270
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
170
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1k
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
190
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
200
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
1
10k
Rails Frontend Evolution: It Was a Setup All Along
skryukov
0
140
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
390
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
690
Docker and Python
trallard
44
3.5k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Statistics for Hackers
jakevdp
799
220k
Adopting Sorbet at Scale
ufuk
77
9.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Gamification - CAS2011
davidbonilla
81
5.4k
Transcript
goleak Ͱ gorou*ne leak Λݕग़͢Δ 2020-01-25 Umeda.go 2020 Winter Yosuke
Kumakura
About • kumatch / ۽༸հ • freee גࣜձࣾ ΤϯδχΞ •
࠷ۙͷؔ৺ےτϨ
gorou%ne leak • channel sync ύοέʔδͳͲΛͬͨʮͪঢ়ଶʯͷ gorou/ne • ϓϩηε͕ଓ͘ݶΓΔ
= memory leak • ͪࣗମ Go ϥϯλΠϜ͕ΑΖ͘͠Δ • CPU ফඅؾʹͳΒͳ͍
gorou%ne leak ൃੜͷྫ 1 func Do(ctx context.Context, send chan int)
chan int { 2 recv := make(chan int) 3 go func() { 4 for { 5 select { 6 case num := <-recv: 7 send <- num 8 case <-ctx.Done(): // if do not receive 9 return // if do not return 10 } 11 } 12 }() 13 return recv 14 }
uber-go/goleak • h#ps:/ /github.com/uber-go/goleak • gorou7ne leak Λͬ͘͞ͱݕग़Ͱ͖Δศརౕ • ࠷ۙ
(2020-01-08) v1.0.0 ʹͳͬͨ
uber-go/goleak usage import ( "testing" "go.uber.org/goleak" ) func TestMain(m *testing.M)
{ goleak.VerifyTestMain(m) }
uber-go/goleak demo h"ps:/ /github.com/kumatch-sandbox/goleak
uber-go/goleak ͷΈ • ςετ࣮ߦޙʹ run&me.Stack ͰελοΫτϨʔεΛऔΔ • ͦͷதͷ͏ͪ goleak ͕
gorou&ne Λআ֎ • ࣗΛ࣮ߦ͍ͯ͠Δ gorou&ne ͱ͔ • ʮͬͨ gorou&neʯɺऴΘͬͯͳ͍ͭͱͯ͠ѻ͍ग़ྗ
ߟྀ • ͋͘·Ͱ࣮ߦͨ݁͠Ռʹجͮ͘ݕग़ • ߏจղੳͯ͠Βͤͯ͘ΕΔΘ͚Ͱͳ͍ • ίʔυΧόϨοδ͕͍ɾ࣮ར༻ίʔυͱςετίʔυ͕૬ҧ ͍ͯ͠Δ߹࿙ΕΔՄೳੑ͕͋Δ • ςετͰޙॲཧ͔ͬ͠Γॻ͘͜ͱ
·ͱΊ • uber-go/goleak Λςετίʔυʹ͑ gorou.ne leak Λݟͭ ͚ΒΕΔ • طଘίʔυΛม͑Δ͜ͱͳ͘
TestMain() ʹҰߦॻ͚ͩ͘Ͱ ༗ޮ • ࣮ߦ݁Ռʹର͢Δݕग़ͷͨΊదͳར༻ମܥͰςετίʔυΛ ॻ͘͜ͱ