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
goleak で goroutine leak を検出する
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
kumatch
January 25, 2020
Programming
570
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
goleak で goroutine leak を検出する
kumatch
January 25, 2020
More Decks by kumatch
See All by kumatch
umedago-20190726.pdf
kumatch
0
71
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
180
The Rails Doctrine Decade
koic
2
590
Workers Cache を知る
syumai
0
360
ActionController meets Protocol Buffers
sorah
0
520
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
golang-bob.pdf
iwatsukayura
0
130
ChromeでローカルLLM
ryu1013
0
140
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
R8 の設定見直しでアプリサイズ削減
andpad
0
220
カツオ、ご期待ください
suneo3476
0
190
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
KATA
mclloyd
PRO
35
16k
Writing Fast Ruby
sferik
630
63k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Balancing Empowerment & Direction
lara
6
1.3k
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() ʹҰߦॻ͚ͩ͘Ͱ ༗ޮ • ࣮ߦ݁Ռʹର͢Δݕग़ͷͨΊదͳར༻ମܥͰςετίʔυΛ ॻ͘͜ͱ