puma v4 では SIGTERM での worker process ゾンビ化に気をつけよう / Be aware of zombie processes in puma v4

puma v4 では SIGTERM での worker process ゾンビ化に気をつけよう / Be aware of zombie processes in puma v4

Meguro.rb#29 LT で話した内容です!
puma v4 では「worker process に SIGTERM を送ると zombie process が生まれる」という挙動に変わりました。これが原因で問題が起きた弊社の経験を踏まえて、puma v4 で zombie process に気をつけようという話をしました。
https://megurorb.connpass.com/event/140137/

2b4f9f20b554d4c77c46fe6a9930d6fe?s=128

Nao Minami

July 31, 2019
Tweet

Transcript

  1. ©2019 Wantedly, Inc. QVNBWͰ͸4*(5&3.Ͱͷ XPSLFSQSPDFTTκϯϏԽʹؾΛ͚ͭΑ͏ 31.Jul.2019 - Nao Minami (@south37)

    Wantedly, Inc. Meguro.rb #29
  2. ©2019 Wantedly, Inc. /BP.JOBNJ *OGSBTUSVDUVSF&OHJOFFS 8BOUFEMZ *OD (JU)VCTPVUI 5XJUUFSTPVUI 

    43&ͱͯ͠ͷ໾ׂʢαʔϏεͷ৴པੑʹ੹೚ʣ  ։ൃج൫ͱͯ͠ͷ໾ׂʢΤϯδχΞͷੜ࢈ੑʹ੹೚ʣ
  3. ©2019 Wantedly, Inc. ͸͡Ίʹ

  4. ©2018 Wantedly, Inc. ͋Δ೔ಥવɺ5ISFBE&SSPS͕ଟൃ

  5. ©2018 Wantedly, Inc.

  6. ©2018 Wantedly, Inc. 5ISFBE&SSPS͸ಛఆͷ&$JOTUBODFʹूத w ಉ͡छྨͷDPOUBJOFSͰ΋ɺҧ͏&$JOTUBODFͰಈ͍͍ͯΔ΋ͷͰ͸ൃੜͯ͠ͳ͍ w ಛఆͷ&$JOTUBODFͰ໰୊͕ى͖͍ͯΔɻɻɻʁ ௐࠪͯ͠෼͔ͬͨࣄ LTDMVTUFS

    ಛఆͷ&$JOTUBODFͰͷΈ5ISFBE&SSPSଟൃ
  7. ©2018 Wantedly, Inc. ࣍ʹɺ5ISFBE&SSPSΛ۷ΓԼ͛ͯΈΔ

  8. ©2018 Wantedly, Inc.

  9. ©2018 Wantedly, Inc. QUISFBE@DSFBUFͰ&"("*/͕ฦͬͯΔΒ͍͠

  10. ©2018 Wantedly, Inc. IUUQNBOPSHMJOVYNBOQBHFTNBOQUISFBE@DSFBUFIUNM&33034ΑΓҾ༻ QUISFBE@DSFBUFͷNBOΛ֬ೝ

  11. ©2018 Wantedly, Inc. 5ISFBEΛ࡞ΔͨΊͷϦιʔε͕଍Γͳ͍ 5ISFBE਺ͷ੍ݶʹୡ͢Δ w 3-*.*5@/130$VTFS*%͝ͱͷQSPDFTT UISFBE਺੍ݶ w QSPDTZTLFSOFMUISFBETNBYLFSOFMͷTZTUFNXJEFͳQSPDFTT

    UISFBE਺੍ݶ w QSPDTZTLFSOFMQJE@NBYQJEͷ࠷େ஋ w զʑͷ؀ڥͰ͸  ͲΜͳ࣌ʹQUISFBE@DSFBUFͰ&"("*/͕ฦΔͷ͔ʁ
  12. ©2018 Wantedly, Inc. ֘౰ͷ&$JOTUBODFͰ 5ISFBE਺ͳͲԿ͔͠ΒͷϦιʔε͕ ރׇͯ͠ΔՄೳੑ͕ߴ͍

  13. ©2018 Wantedly, Inc. Ͱ͸ɺ࣮ࡍʹԿ͕໰୊ͳͷ͔ʁ ໰୊੾Γ෼͚ͷҝʹϞχλϦϯάΛڧԽͨ͠

  14. ©2019 Wantedly, Inc. ϞχλϦϯά݁Ռ

  15. ©2018 Wantedly, Inc. &$JOTUBODF͝ͱͷUISFBE਺Λܭଌ

  16. ©2018 Wantedly, Inc. ࣌ؒܦաͱͱ΋ʹUISFBE਺͕૿େͯ͠   QJE@NBY ۙ͘ʹୡ͢Δͱ 5ISFBE&SSPS͕ଟൃ

  17. ©2018 Wantedly, Inc. 5ISFBE&SSPSͷݪҼ͸൑໌ w ΄΅࣮֬ʹɺUISFBE਺͕  QSPDTZTLFSOFMQJE@NBY ʹୡͨ͜͠ͱ͕ݪҼ Ͱ͸ɺͳͥUISFBE਺͕ٸ૿ͯ͠Δͷ͔ʁ

    w ໰୊੾Γ෼͚ͷͨΊʹɺDPOUBJOFS͝ͱͷUISFBE਺ΛݟͯΈΔ ঢ়گΛ੔ཧ͢Δ
  18. ©2018 Wantedly, Inc. DPOUBJOFS͝ͱͷUISFBE਺Λܭଌ

  19. ©2018 Wantedly, Inc. ಛఆͷDPOUBOFS͚ͩUISFBE਺͕ٸ૿

  20. ©2018 Wantedly, Inc. ࣮͸ɺ͜ͷDPOUBJOFS͸QVNBͰ ࠷ۙQVNBWʹWFSTJPO্͕͕͍ͬͯͨ

  21. ©2018 Wantedly, Inc.

  22. ©2018 Wantedly, Inc. [PNCJFQSPDFTT

  23. ©2018 Wantedly, Inc. QVNBWͰ͸ɺXPSLFSQSPDFTTʹ4*(5&3. ΛૹΔͱ[PNCJFQSPDFTT͕࢒Δ w 4*(5&3.ͰXPSLFSQSPDFTTΛࡴͨ͢ͼʹ[PNCJFQSPDFTT͕૿͍͑ͯ͘ զʑ͸QVNB@XPSLFS@LJMMFSΛซ༻ w QVNB@XPSLFS@LJMMFS͸NFNPSZ࢖༻ྔ΍࣌ؒΛUSJHHFSʹXPSLFSQSPDFTT΁

    4*(5&3.ΛૹΔ w QVNB@XPSLFS@LJMMFSʹLJMM͞Εͯɺ࣌ؒͱͱ΋ʹ[PNCJFQSPDFTT͕૿৩͍ͯͨ͠ Կ͕ى͖͍͔ͯͨʁ
  24. ©2018 Wantedly, Inc. 13͕طʹ࡞ΒΕ͍ͯͨͷͰ ଴ͯ͹मਖ਼͞ΕΔ͸ͣɻɻɻ ͨͩɺϝϯςφͷؔ৺͸௿͍

  25. ©2018 Wantedly, Inc.

  26. ©2018 Wantedly, Inc. QVNBͷϝϯςφʹ զʑͷঢ়گ΋ใࠂͨ͠

  27. ©2018 Wantedly, Inc.

  28. ©2019 Wantedly, Inc. ·ͱΊ

  29. ©2018 Wantedly, Inc. QVNBWͰ͸XPSLFSQSPDFTT͕4*(5&3. ͰκϯϏԽ͢Δ w QVNB@XPSLFS@LJMMFSͳͲҰ෦ͷπʔϧͱ૬ੑ͕ѱ͍ͷͰ஫ҙ w طʹJTTVFʹͳ͍ͬͯΔͷͰɺQVNBଆͷରԠΛ଴ͭࣄ΋ग़དྷΔ 5ISFBE਺͸؂ࢹର৅ʹೖΕ͓ͯ͘ͱྑ͍

    w ҙਤͤͣ૿Ճ͍ͯ͠Δࣄʹؾ͚ͮΔΑ͏ʹ͠Α͏ ·ͱΊ
  30. ©2019 Wantedly, Inc. "QQFOEJY

  31. ©2018 Wantedly, Inc. "QQFOEJY-JOVYʹ͓͚Δ5ISFBEͱQJEͷؔ܎ IUUQTTUBDLPWFSqPXDPNRVFTUJPOTJGUISFBETTIBSFUIFTBNFQJEIPXDBOUIFZCFJEFOUJpFEΑΓҾ༻ 5ISFBE͸શͯVOJRVFͳQJEΛ࣋ͭ w AQYBVY)AͳͲͰݟ͍ͤͯΔ1*%͸ݫີʹ͸UHJE UISFBEHSPVQJE 

    w ҎԼͷBTDJJBSU͕෼͔Γ΍͘͢ߏ଄Λઆ໌͍ͯ͠Δ
  32. ©2018 Wantedly, Inc. "QQFOEJY-JOVYʹ͓͚ΔDPOUBJOFS OBNFTQBDF ͱQJEͷؔ܎ 1SPDFTT͸lQJEOBNFTQBDFz͝ͱʹQJEΛ࣋ͭ w QJEOBNFTQBDF͸ωετՄೳ w

    ࠷΋SPPUͰ͸DPOUBJOFS QJEOBNFTQBDF ಺෦ͷQSPDFTT΋ؚΊͯશͯͷQSPDFTTʹ VOJRVFͳQJE͕ͭ͘ w ࠓճ͸ɺSPPUͷQSPDTZTLFSOFMQJE@NBYʹୡͯ͠͠·ͬͯ໰୊͕ى͖ͨ ৄࡉ͸IUUQNBOPSHMJOVYNBOQBHFTNBOQJE@OBNFTQBDFTIUNMΛࢀর
  33. ©2019 Wantedly, Inc. w %BOJFM+FOTFOIUUQTVOTQMBTIDPNQIPUPT/.L7HHUIH 1IPUP$SFEJU