Node crash during longhaul testing (possibly snapshot issue)
CCF node crashed during persistent create new items (PUT requests) in the kv map for 1:30 hrs of testing. There was an attempted write on the ring buffers of size ~ 16 MB
Logs
2021-07-15T11:00:13.319687Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_60027_60028" with evidence proof committed at 60050
2021-07-15T11:15:24.927869Z 100 [fail ] ../src/ds/messaging.h:174 | Exception while processing message <AdminMessage::fatal_error_msg:1968599046> of size 68
2021-07-15T11:15:24.927883Z 100 [fail ] ../src/ds/messaging.h:176 | Requested a write of 17755110 bytes, max allowed is 16777216
2021-07-15T11:15:24.928291Z 100 [fatal] ../src/ds/stacktrace_utils.h:53 | Handled fatal signal 6
Possibly because of snapshots (a snapshot was due by the 15 min interval)
snapshot dir
$ ls -lh scripts/workspace/sandbox_0/0.snapshots/
total 53M
-rw-rw-r-- 1 azureuser azureuser 2.9M Jul 15 09:44 snapshot_10000_10001.committed_10023
-rw-rw-r-- 1 azureuser azureuser 5.2M Jul 15 09:59 snapshot_20010_20012.committed_20034
-rw-rw-r-- 1 azureuser azureuser 7.6M Jul 15 10:14 snapshot_30011_30013.committed_30035
-rw-rw-r-- 1 azureuser azureuser 9.9M Jul 15 10:29 snapshot_40016_40018.committed_40040
-rw-rw-r-- 1 azureuser azureuser 13M Jul 15 10:44 snapshot_50024_50026.committed_50048
-rw-rw-r-- 1 azureuser azureuser 15M Jul 15 11:00 snapshot_60027_60028.committed_60050
azureuser@daphne-accvm-1:~/DaphneA-Svc/ccfapp$
To Reproduce
Continously create new items in kv map (or PUT objects)
Expected behavior PUTs should succeed
Environment information
2021-07-15T09:24:06.286810Z 100 [info ] ../src/host/main.cpp:460 | Version: ccf-1.0.5
2021-07-15T09:24:06.286849Z 100 [info ] ../src/host/main.cpp:461 | Run with following options:
version=false
enclave-file="./libjs_generic.enclave.so.signed"
enclave-type=0
consensus=0
worker-threads=0
node-address="127.0.0.1:0"
node-address-file="0.node_address"
rpc-address="127.0.0.1:8000"
rpc-address-file="0.rpc_address"
public-rpc-address="127.0.0.1:8000"
ledger-dir="0.ledger"
snapshot-dir="0.snapshots"
ledger-chunk-bytes=5000000
snapshot-tx-interval=10000
max-open-sessions=1000
host-log-level=0
log-format-json=false
node-cert-file="0.pem"
node-pid-file="./cchost.pid"
sig-tx-interval=5000
sig-ms-interval=1000
circuit-size-shift=22
raft-timeout-ms=100
raft-election-timeout-ms=4000
bft-view-change-timeout-ms=5000
bft-status-interval-ms=100
max-msg-size=24
max-fragment-size=16
tick-period-ms=10
sn="CN=CCF Node"
jwt-key-refresh-interval-s=1800
memory-reserve-startup=0
curve-id=1
[start]
network-cert-file="networkcert.pem"
constitution="actions.js" "validate.js" "resolve.js" "apply.js"
member-info="member0_cert.pem,member0_enc_pubk.pem"
join.network-cert-file="networkcert.pem"
join.join-timer=1000
recover.network-cert-file="networkcert.pem"
2021-07-15T09:24:06.286867Z 100 [info ] ../src/host/main.cpp:506 | Recovery threshold unset. Defaulting to number of initial consortium members with a public encryption key (1).
2021-07-15T09:24:07.423854Z 100 [info ] ../src/host/ledger.h:787 | Recovered ledger entries up to 0, committed to 0
2021-07-15T09:24:07.423931Z 100 [info ] ../src/host/node_connections.h:179 | Listening for node-to-node on 127.0.0.1:37335
2021-07-15T09:24:07.423974Z 100 [info ] ../src/host/rpc_connections.h:75 | Listening for RPCs on 127.0.0.1:8000
2021-07-15T09:24:07.424150Z 100 [info ] ../src/host/main.cpp:738 | Creating new node: new network (with 1 initial member(s) and 1 member(s) required for recovery)
Azure Quote Provider: libdcap_quoteprov.so [ERROR]: Could not retrieve environment variable for 'AZDCAP_DEBUG_LOG_LEVEL'
2021-07-15T09:24:07.722142Z 100 [info ] ../src/host/main.cpp:817 | Created new node
2021-07-15T09:24:07.722266Z -0.298 0 [info ] ../src/enclave/rpc_sessions.h:55 | Setting max open sessions to 1000
2021-07-15T09:24:07.722273Z -0.298 0 [info ] ../src/consensus/aft/raft.h:2357 | Becoming leader 04464ebff30edacea33e778f3c6a5090136152886175b89db2b7b876981e9a97: 2
2021-07-15T09:24:07.722276Z -0.298 0 [info ] ./src/node/rpc/member_frontend.h:826 | Created service
2021-07-15T09:24:07.722326Z -0.298 0 [info ] ../src/node/node_state.h:1574 | Network TLS connections now accepted
2021-07-15T09:24:07.722331Z -0.298 0 [info ] ../src/node/node_state.h:422 | Created new node 04464ebff30edacea33e778f3c6a5090136152886175b89db2b7b876981e9a97
2021-07-15T09:24:07.723405Z -0.299 0 [info ] ../src/enclave/main.cpp:171 | Starting thread: 0
2021-07-15T09:24:07.723410Z -0.299 0 [info ] ../src/enclave/main.cpp:178 | All threads are ready!
2021-07-15T09:24:11.894819Z -0.013 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid nOo3ZDrODXEK1jKWhXslHR_KXEg
2021-07-15T09:24:11.894842Z -0.013 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid l3sQ-50cCH4xBVZLHTGwnSR7680
2021-07-15T09:24:11.894845Z -0.013 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid DqUu8gf-nAgcyjP3-SuplNAXAnc
2021-07-15T09:24:11.894848Z -0.013 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid OzZ5Dbmcso9Qzt2ModGmihg30Bo
2021-07-15T09:24:11.895913Z -0.014 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid 1LTMzakihiRla_8z2BEJVXeWMqo
2021-07-15T09:24:11.895924Z -0.014 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid bW8ZcMjBCnJZS-ibX5UQDNStvx4
2021-07-15T09:24:13.927445Z -0.010 0 [info ] ../src/node/jwt.h:257 | Proposal <js>: Storing JWT signing key with kid daphne-key
2021-07-15T09:24:17.002572Z -0.002 0 [info ] ../src/node/rpc/frontend.h:479 | Service state is OPEN, now accepting user transactions
2021-07-15T09:44:03.647303Z 100 [info ] ../src/host/snapshot.h:157 | Writing new snapshot to snapshot_10000_10001 [2982545]
2021-07-15T09:44:05.616504Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_10000_10001" with evidence proof committed at 10023
2021-07-15T09:59:18.692851Z 100 [info ] ../src/host/snapshot.h:157 | Writing new snapshot to snapshot_20010_20012 [5447526]
2021-07-15T09:59:20.596361Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_20010_20012" with evidence proof committed at 20034
2021-07-15T10:14:32.925543Z 100 [info ] ../src/host/snapshot.h:157 | Writing new snapshot to snapshot_30011_30013 [7912238]
2021-07-15T10:14:34.827644Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_30011_30013" with evidence proof committed at 30035
2021-07-15T10:29:45.917859Z 100 [info ] ../src/host/snapshot.h:157 | Writing new snapshot to snapshot_40016_40018 [10371582]
2021-07-15T10:29:47.729012Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_40016_40018" with evidence proof committed at 40040
2021-07-15T10:44:58.700191Z 100 [info ] ../src/host/snapshot.h:157 | Writing new snapshot to snapshot_50024_50026 [12832510]
2021-07-15T10:45:00.507519Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_50024_50026" with evidence proof committed at 50048
2021-07-15T11:00:11.517844Z 100 [info ] ../src/host/snapshot.h:157 | Writing new snapshot to snapshot_60027_60028 [15294614]
2021-07-15T11:00:13.319687Z 100 [info ] ../src/host/snapshot.h:184 | Committing snapshot file "snapshot_60027_60028" with evidence proof committed at 60050
2021-07-15T11:15:24.927869Z 100 [fail ] ../src/ds/messaging.h:174 | Exception while processing message <AdminMessage::fatal_error_msg:1968599046> of size 68
2021-07-15T11:15:24.927883Z 100 [fail ] ../src/ds/messaging.h:176 | Requested a write of 17755110 bytes, max allowed is 16777216
2021-07-15T11:15:24.928291Z 100 [fatal] ../src/ds/stacktrace_utils.h:53 | Handled fatal signal 6
We noticed this as a potential issue in #1858, but it looks like we now have an app hitting a consistent repro. Pinging @jumaffre - do you remember where we landed on that issue?
I believe the fix is described in https://github.com/microsoft/CCF/issues/1858#issuecomment-762188246, which isn't trivial. The current limit is set to 2^24, i.e. ~17MB (default value for --max-msg-size option to cchost) which confirms the error observed by @iqsarv. The size limit is applicable for any message that goes on the ring buffer, but it's very likely that snapshots will hit this first. We should prioritise #1858 and potentially backport it to the 1.x LTS branch.
@iqsarv: Could you please confirm which application and payload you are running and whether the load is close to what you're expecting on your deployed service?
@iqsarv the max message size on the ringbuffer can be set with --circuit-size-shift, so if you want to get on with your testing in the meantime, you could set --circuit-size-shift 28 for example.
Note that in all cases, forever appending to the KV store will end up exhausting your (fixed-size) enclave heap. You can monitor your total memory usage with https://microsoft.github.io/CCF/main/operations/operator_rpc_api.html#get--memory.
@jumaffre @achamayou thanks for the response. the application is js based one with multiple APIs. we just started testing a simple PUT /participants with a connection pool of 1000 & 10 PUT/s which creates new entities typically of only few bytes. the notion was to observe when the heap is exhausted. when we tested with 50 PUT/s response time is reaally low, might need help there as well (do we have any TPS numbers that a typical js based app supports)
Report @ 13:43:43(+0000) 2021-07-15
Elapsed time: 30 minutes, 0 seconds
Scenarios launched: 500
Scenarios completed: 361
Requests completed: 361
Mean response/sec: 50
Response time (msec):
min: 27493
max: 27584
median: 27548
p95: 27581.5
p99: 27584
Codes:
200: 361
Same as #1858