mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-15 04:11:02 +01:00
Merge 3a66391bdb
into a50af6e4c4
This commit is contained in:
commit
cf986240e1
3 changed files with 19 additions and 16 deletions
|
@ -204,11 +204,8 @@ this RPC may not yet be reflected as such in this RPC response.
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
There is a known issue in the JSON-RPC interface that can cause a node to crash if
|
When too many connections are opened quickly the interface will start to
|
||||||
too many http connections are being opened at the same time because the system runs
|
respond with 503 Service Unavailable to prevent a crash from running out of file
|
||||||
out of available file descriptors. To prevent this from happening you might
|
descriptors. To prevent this from happening you should try to prevent opening
|
||||||
want to increase the number of maximum allowed file descriptors in your system
|
too many connections to the interface at the same time, for example
|
||||||
and try to prevent opening too many connections to your JSON-RPC interface at the
|
by throttling your request rate.
|
||||||
same time if this is under your control. It is hard to give general advice
|
|
||||||
since this depends on your system but if you make several hundred requests at
|
|
||||||
once you are definitely at risk of encountering this issue.
|
|
||||||
|
|
|
@ -15,14 +15,11 @@ apply.
|
||||||
Limitations
|
Limitations
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
There is a known issue in the REST interface that can cause a node to crash if
|
When too many connections are opened quickly the interface will start to
|
||||||
too many http connections are being opened at the same time because the system runs
|
respond with 503 Service Unavailable to prevent a crash from running out of file
|
||||||
out of available file descriptors. To prevent this from happening you might
|
descriptors. To prevent this from happening you should try to prevent opening
|
||||||
want to increase the number of maximum allowed file descriptors in your system
|
too many connections to the interface at the same time, for example
|
||||||
and try to prevent opening too many connections to your rest interface at the
|
by throttling your request rate.
|
||||||
same time if this is under your control. It is hard to give general advice
|
|
||||||
since this depends on your system but if you make several hundred requests at
|
|
||||||
once you are definitely at risk of encountering this issue.
|
|
||||||
|
|
||||||
Supported API
|
Supported API
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -478,6 +478,15 @@ bool InitHTTPServer(const util::SignalInterrupt& interrupt)
|
||||||
int workQueueDepth = std::max((long)gArgs.GetIntArg("-rpcworkqueue", DEFAULT_HTTP_WORKQUEUE), 1L);
|
int workQueueDepth = std::max((long)gArgs.GetIntArg("-rpcworkqueue", DEFAULT_HTTP_WORKQUEUE), 1L);
|
||||||
LogDebug(BCLog::HTTP, "creating work queue of depth %d\n", workQueueDepth);
|
LogDebug(BCLog::HTTP, "creating work queue of depth %d\n", workQueueDepth);
|
||||||
|
|
||||||
|
#if LIBEVENT_VERSION_NUMBER >= 0x02020001
|
||||||
|
if (event_get_version_number() >= 0x02020001) {
|
||||||
|
// Limit the maximum number of open connections to prevent exhausting
|
||||||
|
// the file descriptor limit. When the http server gets overwhelmed it
|
||||||
|
// will respond with 503 Service Unavailable.
|
||||||
|
evhttp_set_max_connections(http, workQueueDepth * 2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
g_work_queue = std::make_unique<WorkQueue<HTTPClosure>>(workQueueDepth);
|
g_work_queue = std::make_unique<WorkQueue<HTTPClosure>>(workQueueDepth);
|
||||||
// transfer ownership to eventBase/HTTP via .release()
|
// transfer ownership to eventBase/HTTP via .release()
|
||||||
eventBase = base_ctr.release();
|
eventBase = base_ctr.release();
|
||||||
|
|
Loading…
Add table
Reference in a new issue