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

Doesn't always wait for bitcoind to be fully started up #498

Open
markasoftware opened this issue Mar 17, 2017 · 11 comments
Open

Doesn't always wait for bitcoind to be fully started up #498

markasoftware opened this issue Mar 17, 2017 · 11 comments

Comments

@markasoftware
Copy link

When starting up bitcore-node now, I get the following error:

[2017-03-17T01:14:29.849Z] warn: Activating best chain...
[2017-03-17T01:14:34.855Z] warn: Activating best chain...
[2017-03-17T01:14:39.859Z] warn: Activating best chain...
[2017-03-17T01:14:44.866Z] warn: Activating best chain...
[2017-03-17T01:14:49.872Z] warn: Activating best chain...
[2017-03-17T01:14:54.879Z] warn: Activating best chain...
[2017-03-17T01:14:59.883Z] warn: Activating best chain...
[2017-03-17T01:15:04.895Z] warn: Activating best chain...
[2017-03-17T01:15:04.942Z] error: Failed to start services
[2017-03-17T01:15:04.942Z] error: RPCError: Activating best chain...
    at Bitcoin._wrapRPCError (/home/apg/apg-node/node_modules/bitcore-node/lib/services/bitcoind.js:449:13)
    at /home/apg/apg-node/node_modules/bitcore-node/lib/services/bitcoind.js:779:28
    at IncomingMessage.<anonymous> (/home/apg/apg-node/node_modules/bitcoind-rpc/lib/index.js:107:7)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
[2017-03-17T01:15:10.341Z] error: Failed to stop services: Error: bitcoind spawned process exited with status code: 1

It seems like bitcore is trying to send RPC calls before bitcoind is fully started up, as explained here: http://bitcoin.stackexchange.com/questions/40583/what-does-it-mean-error-code-28-message-activating-best-chain

@dav1app
Copy link

dav1app commented Sep 26, 2017

Having the same problem here. :/

@markasoftware
Copy link
Author

@jhoutromundo ouch :( unfortunately I never really fixed this issue. I ended up putting a hard-coded timeout in to wait 30 minutes before attempting to connect.

@davidraedev
Copy link

I had this error intermittently as well. After some digging it appears to be this line causing the problem.

There is a hardcoded 60 time retry in the initial connect function, and if bitcoind hasn't finished starting up by that point bitcore (wrongly) assumes something has gone wrong.

You should be able to work around this by setting that retry value to something higher.

@davidraedev
Copy link

Just changing that one line didn't actually solve it for me, I also changed the other one here and that solved it.

@xelawafs
Copy link

@daraeman what actual figure did you set?

@davidraedev
Copy link

@xelawafs Looks like I settled on 100,000, but it really just depends on your machine and the state of your data. I think I had it and 10,000 and had to up it since it occasionally still failed.

@xelawafs
Copy link

I initially had it at 200, it failed. Bumped it up to 20000 and now it's back to syncing

@charleslcso
Copy link

@daraeman

Just changing that one line didn't actually solve it for me, I also changed the other one here and that solved it.

What other parameter did you change? Opening the link you provided goes to the same line at

async.retry({times: 60, ...

@charleslcso
Copy link

Got it. Two lines with the same content....

@DaShak
Copy link

DaShak commented Jun 11, 2018

Thanks to @daraeman and others who commented on increasing the hardcoded values for retries, as it worked for me.

This fix applies to another issue thread: bitpay/bitcore#1434

@NeerajThapliyal
Copy link

NeerajThapliyal commented Aug 9, 2018

Thanks to @daraeman
you save my day.
i have changes in

async.retry({times: 60, interval: self.startRetryInterval}, function(done) {

and
async.retry({times: 60, interval: self.startRetryInterval}, function(done) {

line.
change time to 60 to 200.

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

No branches or pull requests

7 participants