Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: explicitly exit process after beacon node closed #5716

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Jun 27, 2023

Motivation

For now, we have to explicitly call process.exit after beacon node closed to prevent process from hanging causing bad user experience.

Description

Call process.exit after close sequence is completed. At this point it is safe to terminate the process.

Ideally, we should not have explicitly exit the process. This change can be reverted once issue is fixed

@nflaig nflaig requested a review from a team as a code owner June 27, 2023 15:33
@wemeetagain wemeetagain enabled auto-merge (squash) June 27, 2023 15:43
@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 2710372 Previous: d9fa355 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 687.54 us/op 1.0130 ms/op 0.68
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 52.999 us/op 54.806 us/op 0.97
BLS verify - blst-native 1.2496 ms/op 1.3268 ms/op 0.94
BLS verifyMultipleSignatures 3 - blst-native 2.5399 ms/op 2.5779 ms/op 0.99
BLS verifyMultipleSignatures 8 - blst-native 5.4359 ms/op 5.5423 ms/op 0.98
BLS verifyMultipleSignatures 32 - blst-native 19.648 ms/op 20.128 ms/op 0.98
BLS aggregatePubkeys 32 - blst-native 26.290 us/op 26.808 us/op 0.98
BLS aggregatePubkeys 128 - blst-native 102.36 us/op 105.08 us/op 0.97
getAttestationsForBlock 63.833 ms/op 61.182 ms/op 1.04
isKnown best case - 1 super set check 272.00 ns/op 266.00 ns/op 1.02
isKnown normal case - 2 super set checks 263.00 ns/op 260.00 ns/op 1.01
isKnown worse case - 16 super set checks 259.00 ns/op 259.00 ns/op 1.00
CheckpointStateCache - add get delete 6.2460 us/op 6.0940 us/op 1.02
validate gossip signedAggregateAndProof - struct 2.8408 ms/op 2.8630 ms/op 0.99
validate gossip attestation - struct 1.3584 ms/op 1.3695 ms/op 0.99
pickEth1Vote - no votes 1.3953 ms/op 1.4108 ms/op 0.99
pickEth1Vote - max votes 11.353 ms/op 11.791 ms/op 0.96
pickEth1Vote - Eth1Data hashTreeRoot value x2048 9.5662 ms/op 9.8988 ms/op 0.97
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 18.524 ms/op 14.993 ms/op 1.24
pickEth1Vote - Eth1Data fastSerialize value x2048 822.54 us/op 785.64 us/op 1.05
pickEth1Vote - Eth1Data fastSerialize tree x2048 9.2042 ms/op 5.2893 ms/op 1.74
bytes32 toHexString 654.00 ns/op 612.00 ns/op 1.07
bytes32 Buffer.toString(hex) 434.00 ns/op 417.00 ns/op 1.04
bytes32 Buffer.toString(hex) from Uint8Array 623.00 ns/op 609.00 ns/op 1.02
bytes32 Buffer.toString(hex) + 0x 440.00 ns/op 420.00 ns/op 1.05
Object access 1 prop 0.20400 ns/op 0.18800 ns/op 1.09
Map access 1 prop 0.17300 ns/op 0.17000 ns/op 1.02
Object get x1000 6.8290 ns/op 6.7820 ns/op 1.01
Map get x1000 0.69100 ns/op 0.64400 ns/op 1.07
Object set x1000 63.721 ns/op 60.713 ns/op 1.05
Map set x1000 51.840 ns/op 48.875 ns/op 1.06
Return object 10000 times 0.25400 ns/op 0.25330 ns/op 1.00
Throw Error 10000 times 4.3361 us/op 4.3852 us/op 0.99
fastMsgIdFn sha256 / 200 bytes 3.5950 us/op 3.6370 us/op 0.99
fastMsgIdFn h32 xxhash / 200 bytes 320.00 ns/op 312.00 ns/op 1.03
fastMsgIdFn h64 xxhash / 200 bytes 466.00 ns/op 502.00 ns/op 0.93
fastMsgIdFn sha256 / 1000 bytes 12.209 us/op 12.384 us/op 0.99
fastMsgIdFn h32 xxhash / 1000 bytes 459.00 ns/op 458.00 ns/op 1.00
fastMsgIdFn h64 xxhash / 1000 bytes 558.00 ns/op 587.00 ns/op 0.95
fastMsgIdFn sha256 / 10000 bytes 107.61 us/op 108.86 us/op 0.99
fastMsgIdFn h32 xxhash / 10000 bytes 2.0290 us/op 2.0480 us/op 0.99
fastMsgIdFn h64 xxhash / 10000 bytes 1.4820 us/op 1.4760 us/op 1.00
enrSubnets - fastDeserialize 64 bits 1.5520 us/op 1.7150 us/op 0.90
enrSubnets - ssz BitVector 64 bits 616.00 ns/op 618.00 ns/op 1.00
enrSubnets - fastDeserialize 4 bits 206.00 ns/op 218.00 ns/op 0.94
enrSubnets - ssz BitVector 4 bits 609.00 ns/op 630.00 ns/op 0.97
prioritizePeers score -10:0 att 32-0.1 sync 2-0 133.79 us/op 115.33 us/op 1.16
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 164.93 us/op 164.54 us/op 1.00
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 212.82 us/op 201.38 us/op 1.06
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 421.72 us/op 382.36 us/op 1.10
prioritizePeers score 0:0 att 64-1 sync 4-1 452.22 us/op 440.82 us/op 1.03
array of 16000 items push then shift 1.7442 us/op 1.7180 us/op 1.02
LinkedList of 16000 items push then shift 9.6510 ns/op 9.1630 ns/op 1.05
array of 16000 items push then pop 127.03 ns/op 112.31 ns/op 1.13
LinkedList of 16000 items push then pop 9.8040 ns/op 8.7430 ns/op 1.12
array of 24000 items push then shift 2.5411 us/op 2.4423 us/op 1.04
LinkedList of 24000 items push then shift 11.053 ns/op 9.4930 ns/op 1.16
array of 24000 items push then pop 89.354 ns/op 86.470 ns/op 1.03
LinkedList of 24000 items push then pop 9.3010 ns/op 9.0600 ns/op 1.03
intersect bitArray bitLen 8 14.255 ns/op 14.100 ns/op 1.01
intersect array and set length 8 100.89 ns/op 98.415 ns/op 1.03
intersect bitArray bitLen 128 46.690 ns/op 46.304 ns/op 1.01
intersect array and set length 128 1.3474 us/op 1.1815 us/op 1.14
Buffer.concat 32 items 3.1870 us/op 3.0720 us/op 1.04
Uint8Array.set 32 items 2.4510 us/op 2.3170 us/op 1.06
transfer serialized Status (84 B) 2.1990 us/op 2.1880 us/op 1.01
copy serialized Status (84 B) 1.8410 us/op 1.7690 us/op 1.04
transfer serialized SignedVoluntaryExit (112 B) 2.2650 us/op 2.1960 us/op 1.03
copy serialized SignedVoluntaryExit (112 B) 1.8960 us/op 1.7740 us/op 1.07
transfer serialized ProposerSlashing (416 B) 2.5640 us/op 2.4500 us/op 1.05
copy serialized ProposerSlashing (416 B) 2.4310 us/op 2.3120 us/op 1.05
transfer serialized Attestation (485 B) 3.0600 us/op 2.7130 us/op 1.13
copy serialized Attestation (485 B) 3.4350 us/op 2.4130 us/op 1.42
transfer serialized AttesterSlashing (33232 B) 3.7780 us/op 2.6760 us/op 1.41
copy serialized AttesterSlashing (33232 B) 10.231 us/op 6.9510 us/op 1.47
transfer serialized Small SignedBeaconBlock (128000 B) 3.7180 us/op 2.9380 us/op 1.27
copy serialized Small SignedBeaconBlock (128000 B) 24.832 us/op 14.942 us/op 1.66
transfer serialized Avg SignedBeaconBlock (200000 B) 4.4350 us/op 3.1910 us/op 1.39
copy serialized Avg SignedBeaconBlock (200000 B) 40.685 us/op 23.740 us/op 1.71
transfer serialized BlobsSidecar (524380 B) 4.2960 us/op 3.5560 us/op 1.21
copy serialized BlobsSidecar (524380 B) 183.65 us/op 159.95 us/op 1.15
transfer serialized Big SignedBeaconBlock (1000000 B) 4.7500 us/op 4.3860 us/op 1.08
copy serialized Big SignedBeaconBlock (1000000 B) 335.19 us/op 265.82 us/op 1.26
pass gossip attestations to forkchoice per slot 2.7715 ms/op 2.9816 ms/op 0.93
forkChoice updateHead vc 100000 bc 64 eq 0 2.1078 ms/op 2.4696 ms/op 0.85
forkChoice updateHead vc 600000 bc 64 eq 0 13.054 ms/op 12.119 ms/op 1.08
forkChoice updateHead vc 1000000 bc 64 eq 0 24.474 ms/op 24.401 ms/op 1.00
forkChoice updateHead vc 600000 bc 320 eq 0 17.327 ms/op 18.401 ms/op 0.94
forkChoice updateHead vc 600000 bc 1200 eq 0 87.737 ms/op 90.997 ms/op 0.96
forkChoice updateHead vc 600000 bc 64 eq 1000 21.227 ms/op 21.749 ms/op 0.98
forkChoice updateHead vc 600000 bc 64 eq 10000 23.597 ms/op 23.736 ms/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 300000 38.522 ms/op 48.407 ms/op 0.80
computeDeltas 3.5990 ms/op 3.2263 ms/op 1.12
computeProposerBoostScoreFromBalances 1.8306 ms/op 1.8311 ms/op 1.00
altair processAttestation - 250000 vs - 7PWei normalcase 3.4856 ms/op 2.7200 ms/op 1.28
altair processAttestation - 250000 vs - 7PWei worstcase 5.0396 ms/op 3.8801 ms/op 1.30
altair processAttestation - setStatus - 1/6 committees join 157.38 us/op 151.14 us/op 1.04
altair processAttestation - setStatus - 1/3 committees join 296.46 us/op 299.20 us/op 0.99
altair processAttestation - setStatus - 1/2 committees join 384.73 us/op 395.11 us/op 0.97
altair processAttestation - setStatus - 2/3 committees join 493.09 us/op 533.62 us/op 0.92
altair processAttestation - setStatus - 4/5 committees join 700.87 us/op 675.80 us/op 1.04
altair processAttestation - setStatus - 100% committees join 805.38 us/op 824.05 us/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase 20.375 ms/op 19.918 ms/op 1.02
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.742 ms/op 30.011 ms/op 1.12
altair processBlock - 250000 vs - 7PWei worstcase 57.482 ms/op 51.433 ms/op 1.12
altair processBlock - 250000 vs - 7PWei worstcase hashState 79.699 ms/op 72.788 ms/op 1.09
phase0 processBlock - 250000 vs - 7PWei normalcase 3.0292 ms/op 2.6879 ms/op 1.13
phase0 processBlock - 250000 vs - 7PWei worstcase 33.350 ms/op 33.129 ms/op 1.01
altair processEth1Data - 250000 vs - 7PWei normalcase 569.26 us/op 517.14 us/op 1.10
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 10.219 us/op 11.992 us/op 0.85
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 33.105 us/op 35.108 us/op 0.94
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 15.803 us/op 14.020 us/op 1.13
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 10.682 us/op 13.894 us/op 0.77
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 127.72 us/op 124.21 us/op 1.03
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 814.60 us/op 800.08 us/op 1.02
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.2116 ms/op 1.3237 ms/op 0.92
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0651 ms/op 1.0094 ms/op 1.06
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.1267 ms/op 3.5941 ms/op 0.87
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.8246 ms/op 1.8923 ms/op 0.96
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.8181 ms/op 5.6079 ms/op 0.86
Tree 40 250000 create 499.13 ms/op 659.61 ms/op 0.76
Tree 40 250000 get(125000) 194.97 ns/op 211.96 ns/op 0.92
Tree 40 250000 set(125000) 1.1828 us/op 2.2841 us/op 0.52
Tree 40 250000 toArray() 24.187 ms/op 29.722 ms/op 0.81
Tree 40 250000 iterate all - toArray() + loop 23.606 ms/op 29.510 ms/op 0.80
Tree 40 250000 iterate all - get(i) 76.765 ms/op 91.524 ms/op 0.84
MutableVector 250000 create 12.589 ms/op 18.194 ms/op 0.69
MutableVector 250000 get(125000) 6.6470 ns/op 10.994 ns/op 0.60
MutableVector 250000 set(125000) 329.76 ns/op 548.67 ns/op 0.60
MutableVector 250000 toArray() 3.9082 ms/op 4.5278 ms/op 0.86
MutableVector 250000 iterate all - toArray() + loop 4.2571 ms/op 5.0454 ms/op 0.84
MutableVector 250000 iterate all - get(i) 1.5580 ms/op 2.1810 ms/op 0.71
Array 250000 create 3.9220 ms/op 4.8396 ms/op 0.81
Array 250000 clone - spread 1.3138 ms/op 2.4374 ms/op 0.54
Array 250000 get(125000) 0.70400 ns/op 1.5540 ns/op 0.45
Array 250000 set(125000) 0.72600 ns/op 1.7950 ns/op 0.40
Array 250000 iterate all - loop 89.833 us/op 99.654 us/op 0.90
effectiveBalanceIncrements clone Uint8Array 300000 56.692 us/op 76.175 us/op 0.74
effectiveBalanceIncrements clone MutableVector 300000 440.00 ns/op 565.00 ns/op 0.78
effectiveBalanceIncrements rw all Uint8Array 300000 171.50 us/op 218.06 us/op 0.79
effectiveBalanceIncrements rw all MutableVector 300000 127.23 ms/op 174.47 ms/op 0.73
phase0 afterProcessEpoch - 250000 vs - 7PWei 123.27 ms/op 140.52 ms/op 0.88
phase0 beforeProcessEpoch - 250000 vs - 7PWei 43.999 ms/op 69.807 ms/op 0.63
altair processEpoch - mainnet_e81889 361.72 ms/op 522.01 ms/op 0.69
mainnet_e81889 - altair beforeProcessEpoch 77.520 ms/op 115.51 ms/op 0.67
mainnet_e81889 - altair processJustificationAndFinalization 20.566 us/op 38.376 us/op 0.54
mainnet_e81889 - altair processInactivityUpdates 8.2606 ms/op 15.877 ms/op 0.52
mainnet_e81889 - altair processRewardsAndPenalties 75.170 ms/op 106.12 ms/op 0.71
mainnet_e81889 - altair processRegistryUpdates 3.4780 us/op 8.7620 us/op 0.40
mainnet_e81889 - altair processSlashings 509.00 ns/op 1.6200 us/op 0.31
mainnet_e81889 - altair processEth1DataReset 775.00 ns/op 1.5630 us/op 0.50
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5086 ms/op 2.1556 ms/op 0.70
mainnet_e81889 - altair processSlashingsReset 9.6340 us/op 13.843 us/op 0.70
mainnet_e81889 - altair processRandaoMixesReset 6.5910 us/op 11.346 us/op 0.58
mainnet_e81889 - altair processHistoricalRootsUpdate 1.6520 us/op 1.5490 us/op 1.07
mainnet_e81889 - altair processParticipationFlagUpdates 4.3260 us/op 7.2700 us/op 0.60
mainnet_e81889 - altair processSyncCommitteeUpdates 772.00 ns/op 1.4880 us/op 0.52
mainnet_e81889 - altair afterProcessEpoch 132.97 ms/op 146.81 ms/op 0.91
phase0 processEpoch - mainnet_e58758 417.28 ms/op 466.84 ms/op 0.89
mainnet_e58758 - phase0 beforeProcessEpoch 162.34 ms/op 197.37 ms/op 0.82
mainnet_e58758 - phase0 processJustificationAndFinalization 18.929 us/op 34.921 us/op 0.54
mainnet_e58758 - phase0 processRewardsAndPenalties 77.099 ms/op 81.194 ms/op 0.95
mainnet_e58758 - phase0 processRegistryUpdates 11.247 us/op 17.465 us/op 0.64
mainnet_e58758 - phase0 processSlashings 594.00 ns/op 1.4510 us/op 0.41
mainnet_e58758 - phase0 processEth1DataReset 720.00 ns/op 1.4090 us/op 0.51
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2281 ms/op 1.9384 ms/op 0.63
mainnet_e58758 - phase0 processSlashingsReset 3.9700 us/op 6.6600 us/op 0.60
mainnet_e58758 - phase0 processRandaoMixesReset 6.9050 us/op 13.839 us/op 0.50
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.0040 us/op 1.8820 us/op 0.53
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.3790 us/op 12.808 us/op 0.50
mainnet_e58758 - phase0 afterProcessEpoch 110.27 ms/op 146.18 ms/op 0.75
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.6331 ms/op 2.4743 ms/op 0.66
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.5260 ms/op 2.5560 ms/op 0.99
altair processInactivityUpdates - 250000 normalcase 32.915 ms/op 32.613 ms/op 1.01
altair processInactivityUpdates - 250000 worstcase 37.585 ms/op 28.861 ms/op 1.30
phase0 processRegistryUpdates - 250000 normalcase 14.400 us/op 14.810 us/op 0.97
phase0 processRegistryUpdates - 250000 badcase_full_deposits 423.77 us/op 368.13 us/op 1.15
phase0 processRegistryUpdates - 250000 worstcase 0.5 159.79 ms/op 175.41 ms/op 0.91
altair processRewardsAndPenalties - 250000 normalcase 79.275 ms/op 70.281 ms/op 1.13
altair processRewardsAndPenalties - 250000 worstcase 87.117 ms/op 76.646 ms/op 1.14
phase0 getAttestationDeltas - 250000 normalcase 10.350 ms/op 13.959 ms/op 0.74
phase0 getAttestationDeltas - 250000 worstcase 9.9539 ms/op 11.552 ms/op 0.86
phase0 processSlashings - 250000 worstcase 4.0878 ms/op 4.6073 ms/op 0.89
altair processSyncCommitteeUpdates - 250000 204.48 ms/op 222.07 ms/op 0.92
BeaconState.hashTreeRoot - No change 282.00 ns/op 301.00 ns/op 0.94
BeaconState.hashTreeRoot - 1 full validator 59.591 us/op 59.577 us/op 1.00
BeaconState.hashTreeRoot - 32 full validator 637.44 us/op 596.45 us/op 1.07
BeaconState.hashTreeRoot - 512 full validator 6.0507 ms/op 6.4824 ms/op 0.93
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 71.729 us/op 70.547 us/op 1.02
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 982.01 us/op 1.0866 ms/op 0.90
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 14.192 ms/op 14.505 ms/op 0.98
BeaconState.hashTreeRoot - 1 balances 51.434 us/op 66.541 us/op 0.77
BeaconState.hashTreeRoot - 32 balances 541.06 us/op 663.11 us/op 0.82
BeaconState.hashTreeRoot - 512 balances 4.6142 ms/op 6.1061 ms/op 0.76
BeaconState.hashTreeRoot - 250000 balances 85.806 ms/op 88.410 ms/op 0.97
aggregationBits - 2048 els - zipIndexesInBitList 20.688 us/op 27.550 us/op 0.75
regular array get 100000 times 45.364 us/op 48.640 us/op 0.93
wrappedArray get 100000 times 36.599 us/op 53.943 us/op 0.68
arrayWithProxy get 100000 times 17.480 ms/op 19.522 ms/op 0.90
ssz.Root.equals 669.00 ns/op 770.00 ns/op 0.87
byteArrayEquals 597.00 ns/op 787.00 ns/op 0.76
shuffle list - 16384 els 7.2329 ms/op 8.1051 ms/op 0.89
shuffle list - 250000 els 116.87 ms/op 118.36 ms/op 0.99
processSlot - 1 slots 10.034 us/op 12.089 us/op 0.83
processSlot - 32 slots 1.4909 ms/op 1.7295 ms/op 0.86
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 42.349 ms/op 42.405 ms/op 1.00
getCommitteeAssignments - req 1 vs - 250000 vc 3.2099 ms/op 3.1270 ms/op 1.03
getCommitteeAssignments - req 100 vs - 250000 vc 4.5345 ms/op 4.4111 ms/op 1.03
getCommitteeAssignments - req 1000 vs - 250000 vc 4.8248 ms/op 4.8129 ms/op 1.00
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.7600 ns/op 5.7300 ns/op 1.01
state getBlockRootAtSlot - 250000 vs - 7PWei 804.06 ns/op 974.92 ns/op 0.82
computeProposers - vc 250000 12.188 ms/op 11.799 ms/op 1.03
computeEpochShuffling - vc 250000 115.74 ms/op 111.76 ms/op 1.04
getNextSyncCommittee - vc 250000 201.19 ms/op 192.07 ms/op 1.05
computeSigningRoot for AttestationData 15.729 us/op 15.692 us/op 1.00
hash AttestationData serialized data then Buffer.toString(base64) 2.5906 us/op 2.6839 us/op 0.97
toHexString serialized data 1.2784 us/op 1.4316 us/op 0.89
Buffer.toString(base64) 367.99 ns/op 369.60 ns/op 1.00

by benchmarkbot/action

@wemeetagain wemeetagain merged commit e35fae0 into unstable Jun 27, 2023
@wemeetagain wemeetagain deleted the nflaig/explicit-exit-on-close branch June 27, 2023 15:51
@philknows philknows added this to the v1.9.1 milestone Jun 28, 2023
@philknows philknows mentioned this pull request Jun 28, 2023
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.9.1 🎉

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.10.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants