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

max coin cache value is unclear #625

Closed
jlopp opened this issue Nov 1, 2018 · 6 comments

Comments

@jlopp
Copy link
Contributor

commented Nov 1, 2018

If I try to run bcoin with more than 4 GB allocated to the coin cache it fails on initialization with an assertion error. Here's the offending line - looks like the bitwise operation may be the problem?

https://github.com/bcoin-org/bcoin/blob/master/lib/blockchain/chain.js#L2787

@pinheadmz

This comment has been minimized.

Copy link
Member

commented Jan 21, 2019

Hey @jlopp catching up on this --

Looks like coin-cache expects a value in MB, so 4GB would be --coin-cache=4000 Not sure why 4000 >>> 0 === 4000 would throw an assertion error there.

I know it's been a few months on this (sorry) do you remember what else was going on?

@pinheadmz pinheadmz added the docs label Jan 21, 2019

@jlopp

This comment has been minimized.

Copy link
Contributor Author

commented Jan 21, 2019

OK, I've reproduced it on master branch again. The max value of the coin cache is 4095; any value of 4096 or greater throws this error:

jameson@node:~/bcoin$ ./bin/node --coin-cache=4096
/home/jameson/bcoin/node_modules/bsert/lib/assert.js:84
    throw new AssertionError({
    ^

AssertionError [ERR_ASSERTION]: Assertion failed.
    at ChainOptions.fromOptions (/home/jameson/bcoin/lib/blockchain/chain.js:2787:7)
    at new ChainOptions (/home/jameson/bcoin/lib/blockchain/chain.js:2693:12)
    at new Chain (/home/jameson/bcoin/lib/blockchain/chain.js:48:20)
    at new FullNode (/home/jameson/bcoin/lib/node/fullnode.js:44:18)
    at Object.<anonymous> (/home/jameson/bcoin/bin/node:24:14)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)

System specs:
nodejs v11.7.0
OS: PureOS 8.0

@pinheadmz

This comment has been minimized.

Copy link
Member

commented Jan 21, 2019

Thank you! Found the bug :-)
https://github.com/bcoin-org/bcfg/blob/master/lib/config.js#L680-L697
Our config parser multiplies the given value * 1024 * 1024, blowing some values out of the 32-bit range. Fix coming soon!

@pinheadmz

This comment has been minimized.

Copy link
Member

commented Feb 4, 2019

@jlopp I have a patch here if you're available/interested in testing your use case: #672

@jlopp

This comment has been minimized.

Copy link
Contributor Author

commented Feb 5, 2019

tested, looks good

@braydonf

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2019

Closed in #736

@braydonf braydonf closed this Apr 2, 2019

@braydonf braydonf removed the has PR label May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.