-
Notifications
You must be signed in to change notification settings - Fork 321
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
example_bitcoind_rpc_polling
sync command ends with stack overflow
#1634
Comments
New information: the database file is ~7.9M. Interestingly I also get a stack overflow when calling the Running `target/debug/example_bitcoind_rpc_polling balance`
confirmed:
total 69500 sats
spendable 69500 sats
immature 0 sats
unconfirmed:
total 0 sats
trusted 0 sats
untrusted 0 sats
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
zsh: abort cargo run --bin example_bitcoind_rpc_polling -- balance I commented out the line here in bdk/example-crates/example_cli/src/lib.rs Lines 810 to 815 in 139d971
Running `target/debug/example_bitcoind_rpc_polling balance`
confirmed:
total 0 sats
spendable 0 sats
immature 0 sats
unconfirmed:
total 0 sats
trusted 0 sats
untrusted 0 sats |
Interesting, I also had this problem a while ago. Will try to reproduce it again and report back. |
Seems to be isolated to the #[test]
fn apply_massive_changeset() {
let (mut chain, _) = LocalChain::from_genesis_hash(genesis_block(Network::Bitcoin).block_hash());
let blocks = (1u32..850_000)
.into_iter()
.map(|height| {
let hash = bitcoin::hashes::Hash::hash(height.to_string().as_bytes());
(height, Some(hash))
})
.collect();
chain.apply_changeset(&ChangeSet { blocks }).unwrap();
} |
I'm having some trouble reproducing this. Can you provide the command sequence you ran @ValuedMammal ? btw, the crate's README needs some updating |
@luisschwab I usually add my descriptors as environment variables and then just follow the help text of the CLI. I'm interested to see if someone can reproduce it, otherwise it could be something specific to my architecture. You're right the README is outdated # setup environment
export DESCRIPTOR="tr([7d94197e/86'/1'/0']tpubDCyQVJj8KzjiQsFjmb3KwECVXPvMwvAxxZGCP9XmWSopmjW3bCV3wD7TgxrUhiGSueDS1MU5X1Vb1YjYcp8jitXc5fXfdC1z68hDDEyKRNr/0/*)"
export CHANGE_DESCRIPTOR="tr([7d94197e/86'/1'/0']tpubDCyQVJj8KzjiQsFjmb3KwECVXPvMwvAxxZGCP9XmWSopmjW3bCV3wD7TgxrUhiGSueDS1MU5X1Vb1YjYcp8jitXc5fXfdC1z68hDDEyKRNr/1/*)"
# specific for example_bitcoind_rpc_polling
# assumes a full node setup locally on signet
export RPC_URL="127.0.0.1:38332"
export RPC_COOKIE=<path-to-your-cookie-file> # e.g. /home/satoshi/.bitcoin/signet/.cookie
export FALLBACK_HEIGHT=1
# initialize database
cargo run --bin example_bitcoind_rpc_polling -- init
# sync
cargo run --bin example_bitcoind_rpc_polling -- sync |
Reproduced in
My DB is similarly large at 8MB.
|
This doesn't really isolate it to the CheckPoint type. It isolates it to the |
I'm using this also as a more targeted litmus test let mut cp = CheckPoint::new(BlockId {
height: 0,
hash: hash!("g"),
});
let end = 10_000;
for height in 1u32..end {
let hash = bitcoin::hashes::Hash::hash(height.to_be_bytes().as_slice());
let block = BlockId { height, hash };
cp = cp.push(block).unwrap();
}
assert_eq!(cp.iter().count() as u32, end); |
Screen of my debugger showing a lot of drop calls. I experimented with writing a custom |
I think this is the solution: #1731. Perhaps that's already what you had in mind? I don't think this drop implementation could cause a performance issue. can you test that for us @ValuedMammal? Thanks! |
I ran another sync on signet and this was the last print [ 1603.0576s] synced to 000000fa810d2c90176b6837b50b0ea53cc0ec63b8e67eae2b1c36e94e0ade34 @ 222615 | total: 0.00069500 BTC |
Ran #1731 and did not experience any issues.
|
2df5861 test(core): test `Drop` implementation of `CPInner` (valued mammal) 67e1dc3 fix(core): Fix checkpoint Drop stack overflow (LLFourn) Pull request description: Fixes #1634 This needs a test that demonstrates the issue is fixed. I was hoping @ValuedMammal could do that for me. ACKs for top commit: ValuedMammal: self-ACK 2df5861 notmandatory: ACK 2df5861 Tree-SHA512: a431cb93505cbde2a9287de09d5faac003b8dfa01342cd22c6ca197d70a73948f94f55dfa365cc06b5be36f78458ed34d4ef5fa8c9e5e2989a21c7ce5b55d9ca
Describe the bug
I ran a sync from genesis using a local signet node. It took around 25 minutes to reach the new tip but ended abruptly before finishing.
To Reproduce
Expected behavior
Build environment
Additional context
The text was updated successfully, but these errors were encountered: