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

RPC server doesn't start when txindex or addrindex #1067

Open
Nargott opened this issue Oct 12, 2017 · 8 comments
Open

RPC server doesn't start when txindex or addrindex #1067

Nargott opened this issue Oct 12, 2017 · 8 comments

Comments

@Nargott
Copy link

Nargott commented Oct 12, 2017

If txindex=1 and/or addrindex=1 enabled in my btcd.conf, then RPC server doesn't start even when it enabled. So, commenting only this lines in btcd.conf makes RPC server start successfully.

@davecgh
Copy link
Member

davecgh commented Oct 13, 2017

Are you sure you don't have a typo leading to the file not being read properly?

I just tested this locally and it works properly.

btcd.conf:

rpcuser=...
rpcpass=...
txindex=1
addrindex=1

btcd:

...
2017-10-13 03:39:48.647 [INF] INDX: Transaction index is enabled
2017-10-13 03:39:48.647 [INF] INDX: Address index is enabled
...
2017-10-13 03:40:05.115 [INF] RPCS: RPC server listening on 127.0.0.1:8334
2017-10-13 03:40:05.115 [INF] RPCS: RPC server listening on [::1]:8334

@Nargott
Copy link
Author

Nargott commented Oct 13, 2017

btcd.conf

[Application Options]
rpcuser=user
rpcpass=passwd
txindex=1
addrindex=1

btcd:

2017-10-13 11:26:20.143 [INF] BTCD: Version 0.12.0-beta
2017-10-13 11:26:20.143 [INF] BTCD: Loading block database from '/home/user/.btcd/data/mainnet/blocks_ffldb'
2017-10-13 11:26:20.229 [INF] BTCD: Block database loaded
2017-10-13 11:26:20.232 [INF] INDX: Transaction index is enabled
2017-10-13 11:26:20.232 [INF] INDX: Address index is enabled
2017-10-13 11:26:20.233 [INF] CHAN: Loading block index.  This might take a while...
2017-10-13 11:26:27.780 [INF] INDX: Catching up indexes from height -1 to 239763

Interrupt btcd:

2017-10-13 11:26:46.144 [INF] BTCD: Received signal (interrupt).  Shutting down...
2017-10-13 11:26:46.144 [ERR] BTCD: Unable to start server on [:8333]: interrupt requested
2017-10-13 11:26:46.144 [INF] BTCD: Gracefully shutting down the database...
2017-10-13 11:26:48.897 [INF] BTCD: Shutdown complete

No message about stopping RPC

@Nargott
Copy link
Author

Nargott commented Oct 13, 2017

But, when

btcd.conf

[Application Options]
rpcuser=user
rpcpass=passwd
#txindex=1
#addrindex=1

btcd:

2017-10-13 11:30:27.858 [INF] BTCD: Version 0.12.0-beta
2017-10-13 11:30:27.858 [INF] BTCD: Loading block database from '/home/user/.btcd/data/mainnet/blocks_ffldb'
2017-10-13 11:30:27.925 [INF] BTCD: Block database loaded
2017-10-13 11:30:27.928 [INF] CHAN: Loading block index.  This might take a while...
...
2017-10-13 11:30:37.883 [INF] RPCS: RPC server listening on 127.0.0.1:8334
...
2017-10-13 11:30:37.977 [INF] CMGR: Server listening on 0.0.0.0:8333
2017-10-13 11:30:37.977 [INF] CMGR: Server listening on [::]:8333

Iterrupt btcd:

2017-10-13 11:30:55.117 [INF] BTCD: Received signal (interrupt).  Shutting down...
2017-10-13 11:30:55.117 [INF] BTCD: Gracefully shutting down the server...
2017-10-13 11:30:55.117 [WRN] SRVR: Server shutting down
2017-10-13 11:30:55.117 [WRN] RPCS: RPC server shutting down
2017-10-13 11:30:55.117 [INF] RPCS: RPC server shutdown complete
2017-10-13 11:30:55.118 [INF] SYNC: Sync manager shutting down
...
2017-10-13 11:30:55.126 [INF] AMGR: Address manager shutting down
2017-10-13 11:30:55.129 [INF] SRVR: Server shutdown complete
2017-10-13 11:30:55.129 [INF] BTCD: Gracefully shutting down the database...
2017-10-13 11:30:56.807 [INF] BTCD: Shutdown complete

@davecgh
Copy link
Member

davecgh commented Oct 13, 2017

The RPC server does not start until the index(es) are caught up.

@Nargott
Copy link
Author

Nargott commented Oct 13, 2017

Yes, I'm not show after that:

btcd.conf

[Application Options]
rpcuser=user
rpcpass=passwd
txindex=1
addrindex=1

btcd:

2017-10-13 11:43:27.296 [INF] BTCD: Version 0.12.0-beta
2017-10-13 11:43:27.297 [INF] BTCD: Loading block database from '/home/user/.btcd/data/mainnet/blocks_ffldb'
2017-10-13 11:43:27.339 [INF] BTCD: Block database loaded
2017-10-13 11:43:27.342 [INF] INDX: Transaction index is enabled
2017-10-13 11:43:27.342 [INF] INDX: Address index is enabled
2017-10-13 11:43:27.342 [INF] CHAN: Loading block index.  This might take a while...
2017-10-13 11:43:36.741 [INF] INDX: Catching up indexes from height 92036 to 239929
2017-10-13 11:43:46.741 [INF] INDX: Indexed 10744 blocks in the last 10s (88984 transactions, height 102780, 2011-01-15 08:55:53 +0100 CET)
2017-10-13 11:43:56.742 [INF] INDX: Indexed 8735 blocks in the last 10s (72713 transactions, height 111515, 2011-03-03 11:19:39 +0100 CET)
2017-10-13 11:44:06.747 [INF] INDX: Indexed 4428 blocks in the last 10s (75956 transactions, height 115943, 2011-03-31 13:52:59 +0200 CEST)
2017-10-13 11:44:16.747 [INF] INDX: Indexed 2933 blocks in the last 10s (34754 transactions, height 118876, 2011-04-17 23:08:02 +0200 CEST)
2017-10-13 11:44:26.752 [INF] INDX: Indexed 2812 blocks in the last 10s (49952 transactions, height 121688, 2011-05-04 00:05:28 +0200 CEST)

@davecgh
Copy link
Member

davecgh commented Oct 13, 2017

You have to wait until the indexes are fully caught up. Notice:

2017-10-13 11:43:36.741 [INF] INDX: Catching up indexes from height 92036 to 239929

The RPC server will not start until the index(es) are up to that 239929.

From your paste, you're only at 121688:

2017-10-13 11:44:26.752 [INF] INDX: Indexed 2812 blocks in the last 10s (49952 transactions, height 121688, 2011-05-04 00:05:28 +0200 CEST)

@nmarley
Copy link

nmarley commented Apr 21, 2018

From my experience, this is just an expected delay upon startup. Should be able to close this I would think.

@begetan
Copy link

begetan commented Feb 3, 2019

I got stucked with this thing until found this issue. I had fully synchronised blockchain for long time until desided to enable RPC and indexing both. If this is a normal behavior could you please make it clean?

  1. Is RPC engine working or not without indexing?
  2. If it isn't working - it shoud be better to make a warnig in log mesage.
  3. If it is working, why it is not running at start-up?
  4. Will it run after indexing will be completed? (I guess It must, but don't know still)

No mater which answers we got it is better to update documentation and/or logging message. Then this issue can be closed.

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

4 participants