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(beacon-node): cleanly exit process on graceful shutdown #5330

Merged
merged 13 commits into from
May 24, 2023

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Apr 1, 2023

Motivation

Cleanly exit beacon node on graceful shutdown without requiring process.exit, closes #5317

Description

Uses why-is-node-running to identify active handles. (alternativ tool: wtfnode)

Most of the time process exits but there are errors such as Error: QUEUE_ERROR_QUEUE_ABORTED.
In some cases the process keeps running, I guess depends on the timing...good news is that workers are all closed correctly

why-is-node-running output

There are 1411 handle(s) keeping the process running

TTYWRAP

node:internal/async_hooks:202
node:internal/bootstrap/switches/is_main_thread:51
node:internal/bootstrap/switches/is_main_thread:170
/home/nico/projects/ethereum/lodestar/node_modules/siginfo/index.js:3 - if (process.stderr.isTTY || force === true) {
/home/nico/projects/ethereum/lodestar/node_modules/why-is-node-running/include.js:3 - require('siginfo')(why, true)
node:internal/modules/cjs/loader:1159
node:internal/modules/cjs/loader:1213
node:internal/modules/cjs/loader:1037

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

... more node:internal/async_hooks:202

TTYWRAP

node:internal/async_hooks:202
node:internal/bootstrap/switches/is_main_thread:51
node:internal/bootstrap/switches/is_main_thread:148
node:internal/bootstrap/loaders:189
node:internal/bootstrap/loaders:311
node:internal/bootstrap/loaders:291
node:internal/bootstrap/loaders:296

TTYWRAP

node:internal/async_hooks:202
node:internal/bootstrap/switches/is_main_thread:196
node:internal/bootstrap/loaders:189
node:internal/bootstrap/loaders:311
node:internal/bootstrap/loaders:291
node:internal/bootstrap/loaders:296
node:internal/bootstrap/loaders:276

DNSCHANNEL

node:internal/async_hooks:202
node:internal/dns/utils:79
node:internal/dns/utils:74
node:internal/dns/utils:241
node:internal/dns/utils:251
node:internal/dns/promises:367
node:internal/bootstrap/loaders:331
node:internal/bootstrap/loaders:362
node:dns/promises:3

JSSTREAM

node:internal/async_hooks:202
node:internal/js_stream_socket:49
/home/nico/projects/ethereum/lodestar/node_modules/http2-wrapper/source/utils/js-stream-socket.js:6 - const JSStreamSocket = (new tls.TLSSocket(new stream.PassThrough()))._handle._parentWrap.constructor;
node:internal/modules/cjs/loader:1159
node:internal/modules/cjs/loader:1213
node:internal/modules/cjs/loader:1037
node:internal/modules/cjs/loader:878
node:internal/modules/cjs/loader:1061

TLSWRAP

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/http2-wrapper/source/utils/js-stream-socket.js:6 - const JSStreamSocket = (new tls.TLSSocket(new stream.PassThrough()))._handle._parentWrap.constructor;
node:internal/modules/cjs/loader:1159
node:internal/modules/cjs/loader:1213
node:internal/modules/cjs/loader:1037
node:internal/modules/cjs/loader:878
node:internal/modules/cjs/loader:1061

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

... more node:internal/async_hooks:202

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/got/node_modules/decompress-response/index.js:43 - const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
file:///home/nico/projects/ethereum/lodestar/node_modules/got/dist/source/core/index.js:549
file:///home/nico/projects/ethereum/lodestar/node_modules/got/dist/source/core/index.js:736
file:///home/nico/projects/ethereum/lodestar/node_modules/got/dist/source/core/index.js:754

nan:test.DelayRequest

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/gc-stats/index.js:17 - gcstats.afterGC(function(stats) {
/home/nico/projects/ethereum/lodestar/node_modules/prometheus-gc-stats/index.js:58 - gc().on('stats', stats => {
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/metrics/nodeJsMetrics.js:14
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/metrics/metrics.js:21
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/node/nodejs.js:81
node:internal/process/task_queues:95
file:///home/nico/projects/ethereum/lodestar/packages/cli/lib/cmds/beacon/handler.js:52

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

Timeout

node:internal/async_hooks:202
node:internal/async_hooks:505
node:internal/timers:159
node:internal/timers:193
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/chain/clock/LocalClock.js:23
node:internal/timers:564
node:internal/timers:507

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

However, it is much better than on unstable branch which never exits

why-is-node-running output on unstable

There are 1436 handle(s) keeping the process running

TTYWRAP

node:internal/async_hooks:202
node:internal/bootstrap/switches/is_main_thread:51
node:internal/bootstrap/switches/is_main_thread:170
/home/nico/projects/ethereum/lodestar/node_modules/siginfo/index.js:3 - if (process.stderr.isTTY || force === true) {
/home/nico/projects/ethereum/lodestar/node_modules/why-is-node-running/include.js:3 - require('siginfo')(why, true)
node:internal/modules/cjs/loader:1159
node:internal/modules/cjs/loader:1213
node:internal/modules/cjs/loader:1037

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

FILEHANDLE

node:internal/async_hooks:202

....more node:internal/async_hooks:202

TTYWRAP

node:internal/async_hooks:202
node:internal/bootstrap/switches/is_main_thread:51
node:internal/bootstrap/switches/is_main_thread:148
node:internal/bootstrap/loaders:189
node:internal/bootstrap/loaders:311
node:internal/bootstrap/loaders:291
node:internal/bootstrap/loaders:296

TTYWRAP

node:internal/async_hooks:202
node:internal/bootstrap/switches/is_main_thread:196
node:internal/bootstrap/loaders:189
node:internal/bootstrap/loaders:311
node:internal/bootstrap/loaders:291
node:internal/bootstrap/loaders:296
node:internal/bootstrap/loaders:276

DNSCHANNEL

node:internal/async_hooks:202
node:internal/dns/utils:79
node:internal/dns/utils:74
node:internal/dns/utils:241
node:internal/dns/utils:251
node:internal/dns/promises:367
node:internal/bootstrap/loaders:331
node:internal/bootstrap/loaders:362
node:dns/promises:3

JSSTREAM

node:internal/async_hooks:202
node:internal/js_stream_socket:49
/home/nico/projects/ethereum/lodestar/node_modules/http2-wrapper/source/utils/js-stream-socket.js:6 - const JSStreamSocket = (new tls.TLSSocket(new stream.PassThrough()))._handle._parentWrap.constructor;
node:internal/modules/cjs/loader:1159
node:internal/modules/cjs/loader:1213
node:internal/modules/cjs/loader:1037
node:internal/modules/cjs/loader:878
node:internal/modules/cjs/loader:1061

TLSWRAP

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/http2-wrapper/source/utils/js-stream-socket.js:6 - const JSStreamSocket = (new tls.TLSSocket(new stream.PassThrough()))._handle._parentWrap.constructor;
node:internal/modules/cjs/loader:1159
node:internal/modules/cjs/loader:1213
node:internal/modules/cjs/loader:1037
node:internal/modules/cjs/loader:878
node:internal/modules/cjs/loader:1061

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/got/node_modules/decompress-response/index.js:43 - const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
file:///home/nico/projects/ethereum/lodestar/node_modules/got/dist/source/core/index.js:549
file:///home/nico/projects/ethereum/lodestar/node_modules/got/dist/source/core/index.js:736
file:///home/nico/projects/ethereum/lodestar/node_modules/got/dist/source/core/index.js:754

nan:test.DelayRequest

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/gc-stats/index.js:17 - gcstats.afterGC(function(stats) {
/home/nico/projects/ethereum/lodestar/node_modules/prometheus-gc-stats/index.js:58 - gc().on('stats', stats => {
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/metrics/nodeJsMetrics.js:14
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/metrics/metrics.js:21
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/node/nodejs.js:81
node:internal/process/task_queues:95
file:///home/nico/projects/ethereum/lodestar/packages/cli/lib/cmds/beacon/handler.js:52

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

Timeout

node:internal/async_hooks:202
node:internal/async_hooks:505
node:internal/timers:159
node:internal/timers:193
file:///home/nico/projects/ethereum/lodestar/packages/reqresp/lib/rate_limiter/ReqRespRateLimiter.js:59
file:///home/nico/projects/ethereum/lodestar/packages/reqresp/lib/ReqResp.js:70
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/network/reqresp/ReqRespBeaconNode.js:46
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/network/network.js:231

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

ZLIB

node:internal/async_hooks:202
/home/nico/projects/ethereum/lodestar/node_modules/node-fetch/lib/index.js:1622 - body = body.pipe(zlib.createGunzip(zlibOptions));

Timeout

node:internal/async_hooks:202
node:internal/async_hooks:505
node:internal/timers:159
node:internal/timers:193
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/chain/clock/LocalClock.js:23
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/chain/clock/LocalClock.js:37
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/chain/clock/LocalClock.js:51
file:///home/nico/projects/ethereum/lodestar/packages/beacon-node/lib/network/network.js:328

How to use this branch

  • Checkout branch
git checkout -b nflaig/cleanly-exit-bn origin/nflaig/cleanly-exit-bn
  • Install & build
yarn install && yarn build
  • Run beacon node
./lodestar beacon --dataDir <data_dir> --execution.urls <el_url> --jwt-secret <jwtsecret> --network goerli
  • Get pid from log
Process ID <pid>
  • Wait for BN to be started, at least sync should start
info: Syncing - 2.5 hours left...
  • Ctrl +C to send SIGINT to process

  • Trigger why-is-node-running logs from another shell (see instructions)

kill -SIGUSR1 <pid>

Next steps

  • identify why process does not shutdown cleanly in some cases
  • get rid of Error: QUEUE_ERROR_QUEUE_ABORTED and other errors
  • implement stoppable Eth1DepositDataTracker
  • probably still need to call process.exit just to make sure...but lets clean up first

Cleanup

  • remove why-is-node-running
  • remove patches/@ChainSafe+threads+1.10.0.patch and patch-package
  • remove console.log

@nflaig

This comment was marked as outdated.

@philknows philknows added this to the v1.8.0 milestone Apr 4, 2023
@nflaig nflaig modified the milestones: v1.8.0, v1.9.0 May 6, 2023
@nflaig nflaig changed the title Attempt to cleanly exit beacon node fix(beacon-node): cleanly exit process on graceful shutdown May 23, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 23, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 677c848 Previous: 5a91e39 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 762.41 us/op 635.25 us/op 1.20
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 83.530 us/op 50.875 us/op 1.64
BLS verify - blst-native 1.3216 ms/op 1.3002 ms/op 1.02
BLS verifyMultipleSignatures 3 - blst-native 2.7128 ms/op 2.6853 ms/op 1.01
BLS verifyMultipleSignatures 8 - blst-native 5.6100 ms/op 5.9925 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst-native 20.297 ms/op 21.457 ms/op 0.95
BLS aggregatePubkeys 32 - blst-native 27.715 us/op 28.300 us/op 0.98
BLS aggregatePubkeys 128 - blst-native 105.58 us/op 110.94 us/op 0.95
getAttestationsForBlock 98.757 ms/op 61.894 ms/op 1.60
isKnown best case - 1 super set check 313.00 ns/op 272.00 ns/op 1.15
isKnown normal case - 2 super set checks 302.00 ns/op 262.00 ns/op 1.15
isKnown worse case - 16 super set checks 303.00 ns/op 275.00 ns/op 1.10
CheckpointStateCache - add get delete 6.5860 us/op 5.7200 us/op 1.15
validate gossip signedAggregateAndProof - struct 2.9811 ms/op 2.9509 ms/op 1.01
validate gossip attestation - struct 1.4061 ms/op 1.4184 ms/op 0.99
pickEth1Vote - no votes 1.5066 ms/op 1.5244 ms/op 0.99
pickEth1Vote - max votes 17.644 ms/op 11.508 ms/op 1.53
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.423 ms/op 9.8749 ms/op 1.16
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 22.022 ms/op 16.041 ms/op 1.37
pickEth1Vote - Eth1Data fastSerialize value x2048 915.24 us/op 750.78 us/op 1.22
pickEth1Vote - Eth1Data fastSerialize tree x2048 10.567 ms/op 7.1551 ms/op 1.48
bytes32 toHexString 954.00 ns/op 509.00 ns/op 1.87
bytes32 Buffer.toString(hex) 566.00 ns/op 350.00 ns/op 1.62
bytes32 Buffer.toString(hex) from Uint8Array 736.00 ns/op 551.00 ns/op 1.34
bytes32 Buffer.toString(hex) + 0x 479.00 ns/op 385.00 ns/op 1.24
Object access 1 prop 0.25600 ns/op 0.17500 ns/op 1.46
Map access 1 prop 0.22100 ns/op 0.16700 ns/op 1.32
Object get x1000 9.6420 ns/op 6.6390 ns/op 1.45
Map get x1000 0.79400 ns/op 0.62200 ns/op 1.28
Object set x1000 105.19 ns/op 54.042 ns/op 1.95
Map set x1000 74.206 ns/op 45.972 ns/op 1.61
Return object 10000 times 0.30670 ns/op 0.24510 ns/op 1.25
Throw Error 10000 times 5.2010 us/op 4.3139 us/op 1.21
fastMsgIdFn sha256 / 200 bytes 3.8580 us/op 3.5730 us/op 1.08
fastMsgIdFn h32 xxhash / 200 bytes 343.00 ns/op 297.00 ns/op 1.15
fastMsgIdFn h64 xxhash / 200 bytes 531.00 ns/op 411.00 ns/op 1.29
fastMsgIdFn sha256 / 1000 bytes 12.686 us/op 11.822 us/op 1.07
fastMsgIdFn h32 xxhash / 1000 bytes 504.00 ns/op 434.00 ns/op 1.16
fastMsgIdFn h64 xxhash / 1000 bytes 674.00 ns/op 478.00 ns/op 1.41
fastMsgIdFn sha256 / 10000 bytes 117.34 us/op 104.30 us/op 1.13
fastMsgIdFn h32 xxhash / 10000 bytes 2.1350 us/op 1.9830 us/op 1.08
fastMsgIdFn h64 xxhash / 10000 bytes 1.5860 us/op 1.4720 us/op 1.08
enrSubnets - fastDeserialize 64 bits 2.2140 us/op 1.3870 us/op 1.60
enrSubnets - ssz BitVector 64 bits 825.00 ns/op 539.00 ns/op 1.53
enrSubnets - fastDeserialize 4 bits 291.00 ns/op 181.00 ns/op 1.61
enrSubnets - ssz BitVector 4 bits 821.00 ns/op 530.00 ns/op 1.55
prioritizePeers score -10:0 att 32-0.1 sync 2-0 166.91 us/op 107.17 us/op 1.56
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 185.10 us/op 144.65 us/op 1.28
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 218.53 us/op 181.00 us/op 1.21
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 446.34 us/op 318.35 us/op 1.40
prioritizePeers score 0:0 att 64-1 sync 4-1 529.93 us/op 380.42 us/op 1.39
array of 16000 items push then shift 2.1660 us/op 1.7179 us/op 1.26
LinkedList of 16000 items push then shift 14.872 ns/op 9.5240 ns/op 1.56
array of 16000 items push then pop 142.12 ns/op 88.867 ns/op 1.60
LinkedList of 16000 items push then pop 12.729 ns/op 8.5740 ns/op 1.48
array of 24000 items push then shift 2.8371 us/op 2.4118 us/op 1.18
LinkedList of 24000 items push then shift 11.734 ns/op 9.1480 ns/op 1.28
array of 24000 items push then pop 96.893 ns/op 76.055 ns/op 1.27
LinkedList of 24000 items push then pop 11.319 ns/op 8.5830 ns/op 1.32
intersect bitArray bitLen 8 19.319 ns/op 13.712 ns/op 1.41
intersect array and set length 8 130.76 ns/op 80.066 ns/op 1.63
intersect bitArray bitLen 128 58.797 ns/op 46.082 ns/op 1.28
intersect array and set length 128 2.1480 us/op 1.0935 us/op 1.96
Buffer.concat 32 items 4.0970 us/op 3.0020 us/op 1.36
Uint8Array.set 32 items 3.2310 us/op 2.4830 us/op 1.30
pass gossip attestations to forkchoice per slot 2.5903 ms/op 2.3738 ms/op 1.09
computeDeltas 3.2557 ms/op 3.5069 ms/op 0.93
computeProposerBoostScoreFromBalances 1.9625 ms/op 1.7896 ms/op 1.10
altair processAttestation - 250000 vs - 7PWei normalcase 4.1666 ms/op 2.0978 ms/op 1.99
altair processAttestation - 250000 vs - 7PWei worstcase 5.5174 ms/op 3.5109 ms/op 1.57
altair processAttestation - setStatus - 1/6 committees join 185.25 us/op 146.64 us/op 1.26
altair processAttestation - setStatus - 1/3 committees join 344.88 us/op 285.98 us/op 1.21
altair processAttestation - setStatus - 1/2 committees join 418.60 us/op 398.78 us/op 1.05
altair processAttestation - setStatus - 2/3 committees join 563.77 us/op 489.64 us/op 1.15
altair processAttestation - setStatus - 4/5 committees join 724.89 us/op 676.56 us/op 1.07
altair processAttestation - setStatus - 100% committees join 787.96 us/op 798.50 us/op 0.99
altair processBlock - 250000 vs - 7PWei normalcase 19.901 ms/op 17.146 ms/op 1.16
altair processBlock - 250000 vs - 7PWei normalcase hashState 29.733 ms/op 25.569 ms/op 1.16
altair processBlock - 250000 vs - 7PWei worstcase 56.230 ms/op 53.651 ms/op 1.05
altair processBlock - 250000 vs - 7PWei worstcase hashState 75.237 ms/op 72.495 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei normalcase 2.5860 ms/op 2.3827 ms/op 1.09
phase0 processBlock - 250000 vs - 7PWei worstcase 33.259 ms/op 30.228 ms/op 1.10
altair processEth1Data - 250000 vs - 7PWei normalcase 554.37 us/op 521.86 us/op 1.06
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 12.599 us/op 8.2230 us/op 1.53
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 27.786 us/op 22.734 us/op 1.22
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 13.735 us/op 8.5730 us/op 1.60
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 11.478 us/op 7.5800 us/op 1.51
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 121.15 us/op 98.901 us/op 1.22
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 728.88 us/op 658.17 us/op 1.11
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 911.27 us/op 912.36 us/op 1.00
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 990.39 us/op 937.80 us/op 1.06
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.5082 ms/op 2.5723 ms/op 0.98
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.7780 ms/op 1.8014 ms/op 0.99
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 4.0205 ms/op 4.0966 ms/op 0.98
Tree 40 250000 create 336.15 ms/op 332.96 ms/op 1.01
Tree 40 250000 get(125000) 195.20 ns/op 203.17 ns/op 0.96
Tree 40 250000 set(125000) 1.1663 us/op 1.0511 us/op 1.11
Tree 40 250000 toArray() 23.931 ms/op 22.611 ms/op 1.06
Tree 40 250000 iterate all - toArray() + loop 26.056 ms/op 23.969 ms/op 1.09
Tree 40 250000 iterate all - get(i) 76.657 ms/op 81.877 ms/op 0.94
MutableVector 250000 create 10.610 ms/op 12.625 ms/op 0.84
MutableVector 250000 get(125000) 6.5220 ns/op 6.9830 ns/op 0.93
MutableVector 250000 set(125000) 316.86 ns/op 363.67 ns/op 0.87
MutableVector 250000 toArray() 4.3341 ms/op 3.8059 ms/op 1.14
MutableVector 250000 iterate all - toArray() + loop 4.4203 ms/op 3.4116 ms/op 1.30
MutableVector 250000 iterate all - get(i) 1.5834 ms/op 1.6547 ms/op 0.96
Array 250000 create 3.7504 ms/op 3.1459 ms/op 1.19
Array 250000 clone - spread 1.2498 ms/op 1.2314 ms/op 1.01
Array 250000 get(125000) 0.63700 ns/op 0.60500 ns/op 1.05
Array 250000 set(125000) 0.72300 ns/op 0.70700 ns/op 1.02
Array 250000 iterate all - loop 107.81 us/op 88.428 us/op 1.22
effectiveBalanceIncrements clone Uint8Array 300000 39.751 us/op 37.303 us/op 1.07
effectiveBalanceIncrements clone MutableVector 300000 358.00 ns/op 368.00 ns/op 0.97
effectiveBalanceIncrements rw all Uint8Array 300000 186.92 us/op 189.98 us/op 0.98
effectiveBalanceIncrements rw all MutableVector 300000 85.240 ms/op 92.735 ms/op 0.92
phase0 afterProcessEpoch - 250000 vs - 7PWei 116.61 ms/op 130.49 ms/op 0.89
phase0 beforeProcessEpoch - 250000 vs - 7PWei 42.881 ms/op 47.815 ms/op 0.90
altair processEpoch - mainnet_e81889 329.94 ms/op 355.35 ms/op 0.93
mainnet_e81889 - altair beforeProcessEpoch 67.774 ms/op 72.703 ms/op 0.93
mainnet_e81889 - altair processJustificationAndFinalization 18.848 us/op 22.522 us/op 0.84
mainnet_e81889 - altair processInactivityUpdates 6.0876 ms/op 6.4110 ms/op 0.95
mainnet_e81889 - altair processRewardsAndPenalties 71.880 ms/op 56.646 ms/op 1.27
mainnet_e81889 - altair processRegistryUpdates 3.2360 us/op 2.9110 us/op 1.11
mainnet_e81889 - altair processSlashings 514.00 ns/op 508.00 ns/op 1.01
mainnet_e81889 - altair processEth1DataReset 656.00 ns/op 775.00 ns/op 0.85
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2735 ms/op 1.3259 ms/op 0.96
mainnet_e81889 - altair processSlashingsReset 7.4070 us/op 5.2450 us/op 1.41
mainnet_e81889 - altair processRandaoMixesReset 4.4720 us/op 7.4490 us/op 0.60
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1390 us/op 1.1720 us/op 0.97
mainnet_e81889 - altair processParticipationFlagUpdates 4.1410 us/op 4.0000 us/op 1.04
mainnet_e81889 - altair processSyncCommitteeUpdates 794.00 ns/op 1.5320 us/op 0.52
mainnet_e81889 - altair afterProcessEpoch 129.22 ms/op 143.67 ms/op 0.90
phase0 processEpoch - mainnet_e58758 366.65 ms/op 501.13 ms/op 0.73
mainnet_e58758 - phase0 beforeProcessEpoch 140.90 ms/op 198.85 ms/op 0.71
mainnet_e58758 - phase0 processJustificationAndFinalization 16.815 us/op 29.180 us/op 0.58
mainnet_e58758 - phase0 processRewardsAndPenalties 64.220 ms/op 79.914 ms/op 0.80
mainnet_e58758 - phase0 processRegistryUpdates 9.0530 us/op 17.874 us/op 0.51
mainnet_e58758 - phase0 processSlashings 588.00 ns/op 1.6020 us/op 0.37
mainnet_e58758 - phase0 processEth1DataReset 554.00 ns/op 1.6270 us/op 0.34
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0496 ms/op 1.4159 ms/op 0.74
mainnet_e58758 - phase0 processSlashingsReset 3.8810 us/op 12.364 us/op 0.31
mainnet_e58758 - phase0 processRandaoMixesReset 4.7270 us/op 13.605 us/op 0.35
mainnet_e58758 - phase0 processHistoricalRootsUpdate 645.00 ns/op 2.0650 us/op 0.31
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.3230 us/op 9.4680 us/op 0.46
mainnet_e58758 - phase0 afterProcessEpoch 100.54 ms/op 125.00 ms/op 0.80
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3050 ms/op 1.6068 ms/op 0.81
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5991 ms/op 1.8986 ms/op 0.84
altair processInactivityUpdates - 250000 normalcase 25.783 ms/op 31.809 ms/op 0.81
altair processInactivityUpdates - 250000 worstcase 28.015 ms/op 24.545 ms/op 1.14
phase0 processRegistryUpdates - 250000 normalcase 7.8880 us/op 8.1010 us/op 0.97
phase0 processRegistryUpdates - 250000 badcase_full_deposits 344.57 us/op 311.01 us/op 1.11
phase0 processRegistryUpdates - 250000 worstcase 0.5 130.67 ms/op 137.40 ms/op 0.95
altair processRewardsAndPenalties - 250000 normalcase 69.890 ms/op 74.113 ms/op 0.94
altair processRewardsAndPenalties - 250000 worstcase 67.867 ms/op 75.349 ms/op 0.90
phase0 getAttestationDeltas - 250000 normalcase 7.1570 ms/op 10.788 ms/op 0.66
phase0 getAttestationDeltas - 250000 worstcase 6.8966 ms/op 10.787 ms/op 0.64
phase0 processSlashings - 250000 worstcase 3.5837 ms/op 4.8886 ms/op 0.73
altair processSyncCommitteeUpdates - 250000 185.60 ms/op 226.76 ms/op 0.82
BeaconState.hashTreeRoot - No change 279.00 ns/op 338.00 ns/op 0.83
BeaconState.hashTreeRoot - 1 full validator 53.702 us/op 58.919 us/op 0.91
BeaconState.hashTreeRoot - 32 full validator 555.31 us/op 689.43 us/op 0.81
BeaconState.hashTreeRoot - 512 full validator 5.1565 ms/op 6.8242 ms/op 0.76
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 64.391 us/op 77.194 us/op 0.83
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 912.51 us/op 1.0648 ms/op 0.86
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 11.597 ms/op 13.896 ms/op 0.83
BeaconState.hashTreeRoot - 1 balances 50.819 us/op 55.827 us/op 0.91
BeaconState.hashTreeRoot - 32 balances 451.49 us/op 480.26 us/op 0.94
BeaconState.hashTreeRoot - 512 balances 4.4558 ms/op 5.0239 ms/op 0.89
BeaconState.hashTreeRoot - 250000 balances 76.292 ms/op 86.590 ms/op 0.88
aggregationBits - 2048 els - zipIndexesInBitList 16.970 us/op 25.253 us/op 0.67
regular array get 100000 times 44.846 us/op 45.123 us/op 0.99
wrappedArray get 100000 times 43.084 us/op 38.039 us/op 1.13
arrayWithProxy get 100000 times 16.476 ms/op 19.589 ms/op 0.84
ssz.Root.equals 587.00 ns/op 678.00 ns/op 0.87
byteArrayEquals 607.00 ns/op 663.00 ns/op 0.92
shuffle list - 16384 els 7.0248 ms/op 7.5599 ms/op 0.93
shuffle list - 250000 els 104.93 ms/op 116.00 ms/op 0.90
processSlot - 1 slots 9.0280 us/op 9.8310 us/op 0.92
processSlot - 32 slots 1.4275 ms/op 1.5472 ms/op 0.92
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 42.090 ms/op 44.524 ms/op 0.95
getCommitteeAssignments - req 1 vs - 250000 vc 3.4070 ms/op 3.0746 ms/op 1.11
getCommitteeAssignments - req 100 vs - 250000 vc 4.8658 ms/op 5.4820 ms/op 0.89
getCommitteeAssignments - req 1000 vs - 250000 vc 5.1318 ms/op 5.3130 ms/op 0.97
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.5300 ns/op 5.6900 ns/op 0.97
state getBlockRootAtSlot - 250000 vs - 7PWei 773.38 ns/op 1.0291 us/op 0.75
computeProposers - vc 250000 12.696 ms/op 14.607 ms/op 0.87
computeEpochShuffling - vc 250000 126.43 ms/op 119.73 ms/op 1.06
getNextSyncCommittee - vc 250000 201.84 ms/op 229.64 ms/op 0.88
computeSigningRoot for AttestationData 17.509 us/op 16.361 us/op 1.07
hash AttestationData serialized data then Buffer.toString(base64) 2.5675 us/op 3.1634 us/op 0.81
toHexString serialized data 1.1548 us/op 2.3190 us/op 0.50
Buffer.toString(base64) 364.68 ns/op 455.39 ns/op 0.80

by benchmarkbot/action

@nflaig nflaig force-pushed the nflaig/cleanly-exit-bn branch 3 times, most recently from cd80dbe to 4f18664 Compare May 23, 2023 14:08
await this.chain.persistToDisk();
await this.chain.close();
await this.db.stop();
if (this.controller) this.controller.abort();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abort must be called before closing db

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, it is best to abort as late as possible in shutdown sequence. This ensures all intervals/timeouts are cleared first and then all remaining pending operations are aborted. Prevents edge case where abort is done and interval schedules another operation which would be stuck pending and delay shutdown.

@nflaig nflaig force-pushed the nflaig/cleanly-exit-bn branch 3 times, most recently from 674b94f to 42a3d70 Compare May 24, 2023 09:10
@nflaig nflaig added the status-do-not-merge Merging this issue will break the build. Do not merge! label May 24, 2023
@nflaig nflaig marked this pull request as ready for review May 24, 2023 11:33
@nflaig nflaig requested a review from a team as a code owner May 24, 2023 11:33
@@ -74,6 +75,12 @@ enum LoggerModule {
sync = "sync",
}

/**
* Short delay before closing db to give async operations sufficient time to complete
* and prevent "Database is not open" errors when shutting down beacon node.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per documentation, "Database is not open" only happens if close is already called and some async operation still tries to execute db queries. If db query is already executed before, the database will wait for any pending operations to finish before closing.

@nflaig nflaig removed the status-do-not-merge Merging this issue will break the build. Do not merge! label May 24, 2023
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.9.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.

Beacon node exits uncontrolled (too early) during graceful shutdown
4 participants