-
Notifications
You must be signed in to change notification settings - Fork 38.7k
libevent http fixes #6695
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
libevent http fixes #6695
Conversation
Ignore SIGPIPE on all non-win32 OSes, otherwise an unexpectedly disconnecting RPC client will terminate the application. This problem was introduced with the libhttp-based RPC server. Fixes bitcoin#6660.
|
utACK (plans to test this soon). |
On the server side it doesn't affect that - it doesn't spend time waiting for input from the client. |
|
Unfortunately I'm 0/2 on testing these. I couldn't recreate the SIGPIPE issue, in master or here, so thats's a start. But I still get what looks like a timeout from getblocktemplate_longpoll.py and I still get errors spewed to stdout when I don't have an IPv6 address. EDIT: as per IRC:
|
|
From IRC: Looks like the issue is not in bitcoin-cli but in the python http functionality that cannot cope with disconnects between requests (as said by @sdaftuar ). Which would be strange, but I'll take a look at it. |
|
The |
I could reproduce it on debian as well. Use a bitcoin-cli command like The SIGPIPE gets emitted when bitcoind starts to write to a closed socket (ctrl-c will terminate bitcoin-cli which ends up in writing to a closed socket on the server side). |
|
@laanwj I know I said I didn't care, but I tracked down the silly warning messages. We need to call event_set_log_callback. I tried it and it works. |
|
concept ACK |
|
@morcos Ah, that'd allow redirecting the messages to our own log. That makes sense in addition to what is done here. Edit: done, the option is -debug=libevent now |
c2b12e5 to
897553e
Compare
|
The Python BadStatusLine on disconnect issue sounds like https://bugs.python.org/issue3566 "httplib persistent connections violate MUST in RFC2616 sec 8.1.4." This was fixed in Python 3.5. I've pushed a commit that should work around it. |
958115d to
c0db185
Compare
|
ACK (modulo missing newlines) |
Add a option "-debug=libevent" to enable libevent debugging for troubleshooting. Libevent logging is redirected to our own log.
c0db185 to
66391e9
Compare
|
Fixed the newline issue (thanks @morcos), removed a spurious change in util.py |
…meout The two timeouts for the server and client, are essentially different: - In the case of the server it should be a lower value to avoid clients clogging up connection slots - In the case of the client it should be a high value to accomedate slow responses from the server, for example for slow queries or when the lock is contended Split the options into `-rpcservertimeout` and `-rpcclienttimeout` with respective defaults of 30 and 900.
Python's httplib does not graciously handle disconnections from the http server, resulting in BadStatusLine errors. See https://bugs.python.org/issue3566 "httplib persistent connections violate MUST in RFC2616 sec 8.1.4." This was fixed in Python 3.5. Work around it for now.
66391e9 to
ddf98d1
Compare
ddf98d1 Make RPC tests cope with server-side timeout between requests (Wladimir J. van der Laan) 2190ea6 rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout (Wladimir J. van der Laan) 8b2d6ed http: Disable libevent debug logging, if not explicitly enabled (Wladimir J. van der Laan) 5ce43da init: Ignore SIGPIPE (Wladimir J. van der Laan)
libevent-based http server Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5677 - bitcoin/bitcoin#6695 - bitcoin/bitcoin#6899 - bitcoin/bitcoin#7016 - bitcoin/bitcoin#7964 - bitcoin/bitcoin#8722 - bitcoin/bitcoin#8730 - bitcoin/bitcoin#9073 - bitcoin/bitcoin#9265 - bitcoin/bitcoin#9387 - bitcoin/bitcoin#9471 - bitcoin/bitcoin#9647 - bitcoin/bitcoin#9903 Closes #1593 and #1856.
libevent-based http server Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5677 - bitcoin/bitcoin#6695 - bitcoin/bitcoin#6899 - bitcoin/bitcoin#7016 - bitcoin/bitcoin#7964 - bitcoin/bitcoin#8722 - bitcoin/bitcoin#8730 - bitcoin/bitcoin#9073 - bitcoin/bitcoin#9265 - bitcoin/bitcoin#9387 - bitcoin/bitcoin#9471 - bitcoin/bitcoin#9647 - bitcoin/bitcoin#9903 - bitcoin/bitcoin#6640 - bitcoin/bitcoin#8139 - bitcoin/bitcoin#8839 Closes #1593 and #1856.

Fix a few rough edges discovered in use of the new libevent http server:;
init: Ignore SIGPIPE
Ignore SIGPIPE on all non-win32 OSes, otherwise an unexpectedly disconnecting
RPC client will terminate the application. This problem was introduced
with the libhttp-based RPC server.
Fixes #6660.
http: Disable libevent debug logging, if not explicitly enabled
Add a option "-debug=libevent" to enable libevent debugging for troubleshooting.
Libevent logging is redirected to our own log.
Addresses stdout spew in #6655.
rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout
The two timeouts for the server and client, are essentially different:
clogging up connection slots
responses from the server, for example for slow queries or when the
lock is contended
Split the options into
-rpcservertimeoutand-rpcclienttimeoutwithrespective defaults of 30 and 900.
Should fix, or make it possible to fix timeout issues in #6655.