Auto merge of #1847 - bitcartel:1680_rpckeepalive_deadlock, r=ebfull
Closes #1680, temporary fix for rpc deadlock inherited from upstream.
This commit is contained in:
commit
4e72614fb0
|
@ -38,13 +38,9 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
|||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
|
||||
#send 2nd request without closing connection
|
||||
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
|
||||
out2 = conn.getresponse().read();
|
||||
assert_equal('"error":null' in out1, True) #must also response with a correct json-rpc message
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
# TODO #1856: Re-enable support for persistent connections.
|
||||
assert_equal(conn.sock!=None, False)
|
||||
conn.close()
|
||||
|
||||
#same should be if we add keep-alive because this should be the std. behaviour
|
||||
|
@ -55,13 +51,9 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
|||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
|
||||
#send 2nd request without closing connection
|
||||
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
|
||||
out2 = conn.getresponse().read();
|
||||
assert_equal('"error":null' in out1, True) #must also response with a correct json-rpc message
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
# TODO #1856: Re-enable support for persistent connections.
|
||||
assert_equal(conn.sock!=None, False)
|
||||
conn.close()
|
||||
|
||||
#now do the same with "Connection: close"
|
||||
|
@ -96,7 +88,10 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
|||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #connection must be closed because bitcoind should use keep-alive by default
|
||||
|
||||
# TODO #1856: Re-enable support for persistent connections.
|
||||
assert_equal(conn.sock!=None, False)
|
||||
conn.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
HTTPBasicsTest ().main ()
|
||||
|
|
|
@ -425,7 +425,10 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), 8232, 18232));
|
||||
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
|
||||
strUsage += HelpMessageOpt("-rpcthreads=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), 4));
|
||||
strUsage += HelpMessageOpt("-rpckeepalive", strprintf(_("RPC support for HTTP persistent connections (default: %d)"), 1));
|
||||
|
||||
// TODO #1856: Re-enable support for persistent connections.
|
||||
// Disabled to avoid rpc deadlock #1680, until we backport upstream changes which replace boost::asio with libevent, or another solution is implemented.
|
||||
//strUsage += HelpMessageOpt("-rpckeepalive", strprintf(_("RPC support for HTTP persistent connections (default: %d)"), 1));
|
||||
|
||||
// Disabled until we can lock notes and also tune performance of libsnark which by default uses multiple threads
|
||||
//strUsage += HelpMessageOpt("-rpcasyncthreads=<n>", strprintf(_("Set the number of threads to service Async RPC calls (default: %d)"), 1));
|
||||
|
|
|
@ -1025,9 +1025,15 @@ void ServiceConnection(AcceptedConnection *conn)
|
|||
// Read HTTP message headers and body
|
||||
ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto, MAX_SIZE);
|
||||
|
||||
// TODO #1856: Re-enable support for persistent connections.
|
||||
// We have disabled support for HTTP Keep-Alive until resolution of #1680, upstream rpc deadlock.
|
||||
// Close connection immediately.
|
||||
fRun = false;
|
||||
/*
|
||||
// HTTP Keep-Alive is false; close connection immediately
|
||||
if ((mapHeaders["connection"] == "close") || (!GetBoolArg("-rpckeepalive", true)))
|
||||
fRun = false;
|
||||
*/
|
||||
|
||||
// Process via JSON-RPC API
|
||||
if (strURI == "/") {
|
||||
|
|
Loading…
Reference in New Issue