bitcoinknots / bitcoin

Bitcoin Knots enhanced Bitcoin node/wallet software
MIT License
200 stars 60 forks source link

`bitcoind` on Windows (gracefully) crashes at start #25

Closed nopara73 closed 4 years ago

nopara73 commented 4 years ago

Tested on Windows 10 and Windows Server 2016 VM.

Bitcoin Core works. Knots on Linux & OSX work.

How to reproduce?

Execute bitcoind.exe.

Relevant Parts of debug.log

2020-03-06T00:31:39Z libevent: getaddrinfo: No error
2020-03-06T00:31:39Z Binding RPC on address ::1 port 8332 failed (Error: No such host is known.  (11001)).
2020-03-06T00:31:39Z Unable to bind all endpoints for RPC server
2020-03-06T00:31:39Z Error: Unable to start HTTP server. See debug log for details.

Full debug.log

2020-03-06T00:31:39Z Bitcoin Knots version v0.19.0.1.knots20200104 (release build)
2020-03-06T00:31:39Z Assuming ancestors of block 000000000000000000009837f74796532b21d8ccf7def3dcfcb45aa92cd86b9e have valid signatures.
2020-03-06T00:31:39Z Setting nMinimumChainWork=000000000000000000000000000000000000000009b4979940395898398bfc8a
2020-03-06T00:31:39Z ParameterInteraction: parameter interaction: -walletimplicitsegwit=0 -> setting -addresstype=legacy
2020-03-06T00:31:39Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2020-03-06T00:31:39Z Using RdSeed as additional entropy source
2020-03-06T00:31:39Z Using RdRand as an additional entropy source
2020-03-06T00:31:39Z Default data directory C:\Users\user\AppData\Roaming\Bitcoin
2020-03-06T00:31:39Z Using data directory C:\Users\user\AppData\Roaming\Bitcoin
2020-03-06T00:31:39Z Config file: C:\Users\user\AppData\Roaming\Bitcoin\bitcoin.conf
2020-03-06T00:31:39Z R/W Config file: C:\Users\user\AppData\Roaming\Bitcoin\bitcoin_rw.conf (not found, skipping)
2020-03-06T00:31:39Z Using at most 125 automatic connections (2048 file descriptors available)
2020-03-06T00:31:39Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2020-03-06T00:31:39Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2020-03-06T00:31:39Z Using 8 threads for script verification
2020-03-06T00:31:39Z scheduler thread start
2020-03-06T00:31:39Z libevent: getaddrinfo: No error
2020-03-06T00:31:39Z Binding RPC on address ::1 port 8332 failed (Error: No such host is known.  (11001)).
2020-03-06T00:31:39Z Unable to bind all endpoints for RPC server
2020-03-06T00:31:39Z Error: Unable to start HTTP server. See debug log for details.
2020-03-06T00:31:40Z Shutdown: In progress...
2020-03-06T00:31:40Z scheduler thread interrupt
2020-03-06T00:31:40Z Shutdown: done
nopara73 commented 4 years ago

Similar: https://github.com/litecoin-project/litecoin/issues/351

nopara73 commented 4 years ago

Tried to remove my bitcoin.conf so to try on default. It didn't work.

nopara73 commented 4 years ago

If I specify both rpcbind and rpcallowip to localhost, then it will start working. I'm not quite sure why yet.

main.rpcbind = 127.0.0.1
main.rpcallowip = 127.0.0.1
luke-jr commented 4 years ago

Can you get the log with the error reporting fixed?

diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index bb960b616f7..6a7a6eed4d2 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -331,7 +331,7 @@ my_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t
                 ignorable_error = true;
                 break;
             default:
-                LogPrintf("libevent: getaddrinfo: %s\n", strerror(errno));
+                LogPrintf("libevent: getaddrinfo: %s\n", evutil_gai_strerror(ai_result));
             }
             return nullptr;
         }
luke-jr commented 4 years ago

Nevermind, I was able to reproduce and fix it.

Upstream/root issue: https://github.com/libevent/libevent/issues/966

Will patch libevent for v0.19.1, as well as include a workaround so building against a broken libevent isn't fatal.