Slide 1

Slide 1 text

8IZJTCVJMEJOHUIF3VCZ FOWJSPONFOUIBSE )JSPTIJ4)*#"5" 3VCZ,BJHJ

Slide 2

Slide 2 text

Hiroshi SHIBATA @hsbt https://hsbt.org Executive Of fi cer VP of Engineering Technical Director at GMO Pepabo, Inc. @pepabo

Slide 3

Slide 3 text

.ZXPSLJO3VCZ • 5IFNBJOUBJOFSPG3VCZ(FNT#VOEMFS 1TZDI +40/ BOEPUIFST • "ENJOJTUSBUPSPGEFWFMPQNFOUQMBUGPSN • $PEF8FC.BJM • (JU)VC3FENJOF • (JU)VC"DUJPOT3VCZ$* • SCFOWSVCZCVJME

Slide 4

Slide 4 text

ͳͥ3VCZͷϏϧυࣄ৘ͷ࿩Λ͢Δͷ͔ • !ITCU͸3VCZ΍3VCZ(FNT SVCZCVJMEͷϝϯςφΛ͠ ͍ͯΔؔ܎͔؀ڥߏஙʹ͍ͭͯ͸ҟৗʹৄ͍͠ • ҰํͰɺଞͷਓʑΛݟΔͱ؀ڥߏஙͱ͍͏ͷ͸؆୯ͳ͜ͱͰ΋ ͳ͘ɺԿ͔͕ϏϧυͰ͖ͳ͍ͱ͍͏͜ͱʹ਺࣌ؒۤઓ͍ͯ͠ΔΒ ͍͠ • ؀ڥߏஙϚχΞͷཱ৔͔Β͜͜࠷ۙͷϏϧυΤϥʔͷ࿩୊Λर͍ ͳ͕ΒɺҰਓͰ΋ϏϧυΤϥʔʹ࣌ؒΛඅ΍͢ਓΛݮΒ͍ͨ͠

Slide 5

Slide 5 text

3VCZͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏

Slide 6

Slide 6 text

3VCZͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏ 6CVOUVͰ Ϗϧυ͕Ͱ͖ͳ͍

Slide 7

Slide 7 text

6CVOUVͰϏϧυ͕Ͱ͖ͳ͍ • ໰୊6CVOUVͰ͸0QFO44-ͷΈఏڙ͞ΕΔΑ͏ʹͳͬ ͨ🐧 • 0QFO44-ʹରԠͨ͠3VCZͷPQFOTTMϥΠϒϥϦ͸3VCZ ʹͷΈ෇ଐ͢Δ • 3VCZ΍͸6CVOUVͰ͸Ϗϧυ͢Δ͜ͱ͕ ؆୯ ʹ͸ Ͱ͖ͳ͍ • IUUQTCVHTSVCZMBOHPSHJTTVFT

Slide 8

Slide 8 text

6CVOUVͰϏϧυ͕Ͱ͖ͳ͍ • ղܾ๏BSVCZCVJMEͰ͸ద౰ͳ0QFO44-ΛϏϧυͯ͠࢖͏ Α͏ʹػೳ௥Ճ͕ͳ͞Εͨ • ैདྷ͸NBD04ͷ-JCSF44-޲͚ͷػೳ • IUUQTHJUIVCDPNSCFOWSVCZCVJMEQVMM • ղܾ๏C3VCZ΁0QFO44-ରԠͷίʔυΛ όοΫϙʔτ͢Δ • ػೳ௥Ճ΋͋Δ͚Ͳେৎ෉ Ͱఀ଺த

Slide 9

Slide 9 text

3VCZͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏ 3VCZ͕NBD04Ͱ ϏϧυͰ͖ͳ͍

Slide 10

Slide 10 text

3VCZ͕NBD04ͰϏϧυͰ͖ͳ͍ • ໰୊3VCZ΍ͷϏϧυ࣌ʹGJEEMFͰΤϥʔ • ղܾ๏BGJEEMFͷΤϥʔΛ௚͢ • ͔͠͠3VCZ͸ϝϯςφϯε͕ऴ͍ྃͯ͠ΔͷͰम ਖ਼͞Εͨ΋ͷ͕ϦϦʔε͞ΕΔ͜ͱ͸ͳ͍ compiling escape.c closure.c:264:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration] result = ffi_prep_closure(pcl, cif, callback, (void *)self); ^ 6 warnings and 1 error generated.

Slide 11

Slide 11 text

3VCZ͕NBD04ͰϏϧυͰ͖ͳ͍ • ղܾ๏CA8OPFSSPSJNQMJDJUGVODUJPOEFDMBSBUJPOAΛ ࢖͏ɻ • ͱΓ͋͑ͣಈ͘ɺͱ͍͏ϨϕϧͳͷͰ஫ҙ • ղܾ๏DA%64&@''*@$-0463&@"--0$AΛ࢖͏ • ͪ͜Β΋ؔ਺ͷݺ͹Εํ͕มΘͬͯͱΓ͋͑ͣϏϧυͰ͖ ͯಈ͘ͱ͍͏΋ͷͳͷͰ஫ҙ

Slide 12

Slide 12 text

3VCZͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏ NBD04 7FOUVSB Ͱ Ϗϧυ͕Ͱ͖ͳ͍

Slide 13

Slide 13 text

NBD04 7FOUVSB ͰϏϧυ͕Ͱ͖ͳ͍ • ໰୊݄͝ΖʹϦϦʔε༧ఆͷNBD04ͷ࣍ͷόʔδϣ ϯ7FOUVSBͰ͸3VCZ͕ϏϧυͰ͖ͳ͍🍎 • IUUQTCVHTSVCZMBOHPSHJTTVFT (snip) linking shared-object -test-/arith_seq/extract.bundle Undefined symbols for architecture arm64: "_rb_arithmetic_sequence_extract", referenced from: _arith_seq_s_extract in extract.o "_rb_ary_new_capa", referenced from: _arith_seq_s_extract in extract.o "_rb_ary_store", referenced from: _arith_seq_s_extract in extract.o "_rb_define_singleton_method", referenced from: _Init_extract in extract.o "_rb_path2class", referenced from: _Init_extract in extract.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Slide 14

Slide 14 text

NBD04 7FOUVSB ͰϏϧυ͕Ͱ͖ͳ͍ • ղܾ๏LBUFJ͕࡞ͬͨɺ"QQMFͷMMWNͷํͷػೳมߋʹ௥ै͢ Δमਖ਼ CVOEMF@MPBEFSΛ࢖͏ ͰϏϧυͰ͖ΔΑ͏ʹͳͬͨ • IUUQTHJUIVCDPNSVCZSVCZQVMM • ʹ΋όοΫϙʔτ͠ͳ͍ͱϏϧυ͸͓ͦΒ͘ෆՄೳ • 13͸࡞ͬͨͷͰɺ7FOUVSBਖ਼ࣜϦϦʔε࣌ʹ͸ΈΜͳ࢖͑Δ Α͏ʹͳΔ͸ͣɻ • 3VCZ͸ϚʔδࡁΈͳͷͰେৎ෉

Slide 15

Slide 15 text

NBD04 7FOUVSB ͰGPSL͕ͳΜ͔ม • AUFTU@QSPDFTTSCAͷGPSLͷςετ͕ಈ͔ͳ͍ • ͓ͦΒ͘ࠓͷ··ͩͱ·ͱ΋ʹ։ൃ͸Ͱ͖ͳͦ͞͏ • ؀ڥม਺ͱͯ͠AFYQPSU0#+$@%*4"#-&@*/*5*"-*;&@'03,@4"'&5::&4AͰͱ Γ͋͑ͣςετ͸ಈ͕͘ • ܧଓௐࠪத TestProcess#test_daemon_noclose objc[10525]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called. objc[10525]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

Slide 16

Slide 16 text

(FNͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏

Slide 17

Slide 17 text

(FNͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏ NZTRM͕ϏϧυͰ͖ͳ͍

Slide 18

Slide 18 text

NZTRM͕ϏϧυͰ͖ͳ͍ • ໰୊NZTRM@DPOGJH͕ݟ͔ͭΒͳ͍ • ղܾ๏ANZTRM@DPOGJHAΛ࢖͏ • ͜ͷखͷΤϥʔ͸QLHDPOGJHࢦఆͰղܾ͢Δ͜ͱ΋͋Δ (snip) checking for my_bool in mysql.h... no ----- Setting rpath to /opt/homebrew/Cellar/mysql/8.0.30/lib ----- $ gem install mysql2 -- --with-mysql-config=/opt/homebrew/bin/mysql_config

Slide 19

Slide 19 text

NZTRM͕ϏϧυͰ͖ͳ͍ • ໰୊MJCTTMͱMJC[TUEͰϦϯΫΤϥʔ • ղܾ๏AMEGMBHTAͱAXJUIDQQGMBHTAΛ࢖͏ (snip) linking shared-object mysql2/mysql2.bundle ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) $ gem i mysql2 -- --with-ldflags=-L(brew --prefix openssl)/lib -L(brew --prefix zstd)/lib \ --with-cppflags=-I(brew --prefix openssl)/include

Slide 20

Slide 20 text

NZTRM͕ͳͥϏϧυͰ͖ͳ͍ͷ͔ • IPNFCSFXͷύεͱґଘϥΠϒϥϦͷ໰୊🍺 • IPNFCSFX͕ఏڙ͢ΔNZTRMͷόΠφϦ͕ϦϯΫ͞ΕͯϥΠϒϥϦ PQFOTTM [TUE ͱSVCZ͕Ϗϧυ͞Εͨ࣌ʹϦϯΫ͞ΕΔϥΠϒϥϦ͕ ෆҰக • .NBD04Ͱ͸APQUIPNFCSFXAʹ΋ͳͬͯΔͷ΋໽հ • IUUQTHJUIVCDPNSCFOWSVCZCVJMEQVMMJTTVFDPNNFOU • ͪͳΈʹ͜ΕΒͷ໰୊͸NZTRMͰࣗಈͰ൑ఆ͞ΕΔΑ͏ʹमਖ਼ࡁΈ

Slide 21

Slide 21 text

CVOEMFEHFNT͕ ϏϧυͰ͖ͳ͍ (FNͷΑ͋͘Δ ϏϧυΤϥʔͱͦͷղܾํ๏

Slide 22

Slide 22 text

CVOEMFEHFNT͕ϏϧυͰ͖ͳ͍ • ໰୊3VCZͰCVOEMFEHFNTͷϏϧυʹࣦഊ͢Δ • IUUQTHJUIVCDPNSVCZSCTJTTVFT • ղܾࡦݪҼෆ໌ • 3VCZ͔ΒCVOEMFEHFNTʹ$FYUFOTJPOͱͯ͠ EFCVHͱSCT͕௥Ճ͞Ε͕ͨ؀ڥʹΑͬͯϏϧυͰ͖ ͳ͍

Slide 23

Slide 23 text

#VOEMFEHFNTͱ3VCZ(FNTͷ੍ݶ • 3VCZ(FNT͸ʮΠϯετʔϧࡁΈͷ3VCZʯΛ૝ఆͯ͠$֦ு ΛϏϧυ͢Δ • ͦͷͨΊʹΠϯετʔϧલɺ·ͨ͸్தʹ$֦ுͷHFNΛ Πϯετʔϧ͢Δͷ͸೉͍͠ • ճආࡦ͸ݱঢ়ͳ͍͕ɺCVOEMFEHFNTΛεΩοϓͯࣗ͠෼Ͱ Πϯετʔϧ͢ΔͳͲखॱ͕ඞཁ ͳͷͰؤுΓ·͢ • 3VCZʹ޲͚ͯͷܧଓ՝୊

Slide 24

Slide 24 text

3VCZͰى͜Γͦ͏ͳ ϏϧυΤϥʔͷ঺հ

Slide 25

Slide 25 text

3VCZͰى͜Γͦ͏ͳ ϏϧυΤϥʔͷ঺հ :+*5͕3VTUʹͳͬͨ

Slide 26

Slide 26 text

:+*5͕3VTUʹͳͬͨ • ໰୊:+*5Λ࢖͏ͨΊʹ͸AFOBCMFZKJUAΦϓγϣϯΛ͚ͭͨ ্ͰSVTUD͕ඞཁ • ࢖͍͍ͨਓ͸SVTUDΛೖΕΔ • 6CVOUVͷBQUͰ͸SVTUDΛೖΕΔ ͜ͱ͕Ͱ͖ΔͷͰ؆୯ • ղܾࡦSVCZCVJMEʹ͸SVTUDͷࣗಈ൑ఆΛߦͬͯඞཁͳΦϓ γϣϯΛ෇༩͢ΔΑ͏ʹͳ͍ͬͯΔͷͰศར

Slide 27

Slide 27 text

SEQBSUZίʔυͷόϯυϧ໰୊ 3VCZͰى͜Γͦ͏ͳ ϏϧυΤϥʔͷ঺հ

Slide 28

Slide 28 text

όϯυϧ͍ͯͨ͠SEQBSUZιʔείʔυͷ࡟আ • ໰୊:".-ϥΠϒϥϦͷQTZDIʹؚ·Ε͍ͯΔMJCZBNMͷιʔε ίʔυΛ࡟আͨͨ͠ΊɺMJCZBNM͕ͳ͍؀ڥͰ͸ϏϧυΤϥʔͱͳΔ • IUUQTCVHTSVCZMBOHPSHJTTVFT • ղܾࡦMJCZBNMΛΠϯετʔϧ͢Δ • 8JOEPXTWDQLH • NBD04IPNFCSFXPS.BD1PSUT • -JOVYBQU EOG QBDNBO

Slide 29

Slide 29 text

SEQBSUZίʔυͷόϯυϧ໰୊ • ݩʑ͸8JOEPXTͰͷϏϧυରࡦ • ೥WDQLHͷ͓͔͛Ͱ͜ͷ໰୊͸ղܾ͍ͯ͠Δ • 3VCZ ίϛολ ͷίϯτϩʔϧͷ֎Ͱมߋ΁ͷରԠίετ͸େ͖ ͍ • όϯυϧ͢Δίʔυͷߋ৽͸৬ਓʹΑΔMJCZBNMͷมߋΛ೺ Ѳ্ͨ͠Ͱͷ3VCZ޲͚ͷύονΛखϚʔδ ITCUXPSL • ੬ऑੑ͕ൃݟ͞Εͨ৔߹͸3VCZຊମͷϦϦʔε΋ඞཁͱͳΔ

Slide 30

Slide 30 text

ϏϧυΤϥʔΛ৐Γӽ͑ͨઌ΁

Slide 31

Slide 31 text

ιϑτ΢ΣΞ͸Կ΋͠ͳ͍ͱյΕΔ • ʮԿ΋ͯ͠ͳ͍ͷʹյΕͨʯ • ιϑτ΢ΣΞΛಈ͔͢؀ڥ͸ઈ͑ͣมԽ͍ͯ͠Δ • 04ɺϛυϧ΢ΣΞɺϋʔυ΢ΣΞ • ੬ऑੑɺαϙʔτίετͳͲ؀ڥͷมԽ͔Β͸ಀΕΒΕͳ͍ • ݱ୅ͷιϑτ΢ΣΞ͸ෳࡶոحͳ૊Έ߹ΘͤͷதͰͳΜͱ͔ಈ͍ͯ ͍Δ • ʮԿ΋͍ͯ͠ͳ͍͔ΒյΕΔʯʮͦΕ͸ͦ͏ʯ

Slide 32

Slide 32 text

ιϑτ΢ΣΞ͕มԽʹదԠ͢Δ • 04΍ϥΠϒϥϦͳͲมԽ͢Δଆ͕มΘͬͨͱ͖ʹ·ͣ͸ಈ͔ ͯ͠ΈΔ • มԽͨ͠ଆͷมߋΛ೺Ѳ͓ͯ͘͠ͱҙ֎ͱ೺ѲͰ͖Δมߋ Ͱ͋Δ͜ͱ͕ଟ͍ • ؀ڥΛߏங͢Δ΋ͷશͯΛ೺Ѳ͢Δ͜ͱ͸ແཧͳͷͰɺม ߋ͢Δͷ͸Օॴʹͯ͠ɺͦΕͧΕৄ͍͠ਓΛͲΜͲΜཔΔ

Slide 33

Slide 33 text

ίϛϡχςΟΛ׆༻͢Δ • Կ΋ͯ͠ͳ͍ͷʹյΕͨ࣌͸IUUQTCVHTSVCZ MBOHPSH΍(JU)VCͷ֤छϦϙδτϦͰใࠂ • Կ͔Λͯ͠յΕͨ࣌΋ใࠂ😇 • SVCZKQTMBDL΍஍ҬϛʔτΞοϓͰฉ͍ͯΈΔ • ʮʙΛʙʹͯ͠ʙΛಈ͔ͯ͠ΈͨΜͰ͚͢Ͳɺಉ͜͡ͱ ΍ͬͨਓ͍·͢ ʯ

Slide 34

Slide 34 text

·ͱΊ

Slide 35

Slide 35 text

3VCZͷϏϧυ͸ ͪΐͬͱ ೉͍͠ • 3VCZ͸αϝͷΑ͏ʹӭ͗ଓ͚ͯมԽ͠ଓ͚Δݴޠ🦈 • ݴޠػೳతͳҙຯ͚ͩͰ͸ͳ͘؀ڥʹదԠ͠ଓ͚͍ͯΔ • ؀ڥ΁ͷదԠ͸ίϛολͷ౒ྗ͚ͩͰ͸ͳ͘ɺଟ͘ͷϢʔβʔͷڠ ྗͰ੒Γཱ͍ͬͯΔ • 4QFDJBMUIBOLTOPCV LBUFJ SIF [O[ LLVCVO FSFHPO • 3VCZͷະདྷʹ޲͚ͯΤίγεςϜ։ൃΛҰॹʹ΍͍͖ͬͯ·͠ΐ͏💎