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
It’s been a while.
Search
ruuuui
September 14, 2017
0
26
It’s been a while.
ruuuui
September 14, 2017
Tweet
Share
More Decks by ruuuui
See All by ruuuui
TCP/IP
ruuuui
0
60
log
ruuuui
0
59
Malware
ruuuui
0
41
File
ruuuui
0
50
リダイレクト
ruuuui
0
38
a
ruuuui
0
50
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
120
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
Docker and Python
trallard
47
3.7k
The agentic SEO stack - context over prompts
schlessera
0
630
Code Review Best Practice
trishagee
74
20k
Designing for Timeless Needs
cassininazir
0
130
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Transcript
ڞ༗ࢿݯʹؔ͢Δ ށݐɹߥҪ ྨ
ϨʔείϯσΟγϣϯ
Race Condition(ڝ߹ঢ়ଶ)ͷ੬ऑੑ ✦ ֓ཁ • ڞ༗ࢿݯͱ ෳͷϓϩηοα͔Βʰಉ࣌ʱʹར༻͍ͯ͠Δ มɾڞ༗ϝϞϦɾDBɾϑΝΠϧͷ͜ͱ ڞ༗ࢿݯʹର͢Δഉଞ੍ޚ͕ෆेͳ߹ ڝ߹ঢ়ଶͷݪҼͱͳΔ
Race Conditionͷදྫ • ผਓͷݸਓใͳͲ͕දࣔ͞ΕΔ • DBͷෆ߹ • ϑΝΠϧ༰ͷഁյ
Πϯελϯεมͱ • ΦϒδΣΫτͷதͰΛอଘ͓ͯͨ͘͠Ίͷར༻͞ΕΔͷ͕ ʮΠϯελϯεมʯͰ͢ɻ • ΠϯελϯεมΫϥεͰશϝιουͰڞ௨ͯ͠༻͢Δ͜ͱ ͕ग़དྷ·͢ɻ • ࠷ॳʹͲ͔͜ͷϝιουͰ༻͞Εͨ࣌ͰΠϯελϯεม࡞ ͞ΕɺҰ࡞͞ΕͨΠϯελϯεมଞͷϝιουͰΛऔ
Γग़ͨ͠Γ֨ೲͨ͠Γ͢Δ͜ͱ͕ग़དྷΔΑ͏ʹͳΓ·͢ɻ
߈ܸख๏ͱӨڹ ӈͷϓϩάϥϜnameจࣈྻΛड͚औͬͯ Πϯελϯεมnameʹೖ͠ɺ̏ඵ·͔ͬͯΒɺ ΠϯελϯεมΛදࣔ͢ΔϓϩάϥϜ
߈ܸख๏ͱӨڹ
• มnameڞ༗ม • ڞ༗มnameͷഉଞ੍ޚΛ͍ͯ͠ͳ͍ ੬ऑੑ͕ੜ·ΕΔݪҼ αʔϒϨοτΫϥεͷΠϯελϯεม͕ ڞ༗ࢿݯͰ͋Δ͜ͱΛΒͳ͍ͱɺىͯ͜͠͠·͏
• ՄೳͰ͋Εڞ༗ࢿݯΛ༻͠ͳ͍ ex. String name = req.getParameter(“name”); • ڞ༗ࢿݯʹରͯ͠ഉଞ੍ޚΛߦ͏ synchronizedจsynchronisedϝιουΛར༻
ରࡦ
yamadaॲཧ tanakaॲཧ 1sec name=“yamada”; ༷ʑͳॲཧ(̏ඵ) nameදࣔ(yamada) SynchronisedʹΑΓػ (̎ඵ) name=“tanaka”; ༷ʑͳॲཧ(̏ඵ)
nameදࣔ(tanaka) 0sec 2sec 3sec 4sec 5sec 6sec
·ͱΊ • ڞ༗ࢿݯͰ͖Δ͚ͩΘͳ͍ • ഉଞॲཧΛ͗ͯ͢͠DoS੬ऑੑΛ࢈ΜͰ͠·͏ͷͰɺ ฒߦॲཧɾϚϧνεϨουϓϩάϥϛϯάΛߦ͏