Skip to content

Conversation

@fjahr
Copy link
Contributor

@fjahr fjahr commented May 22, 2020

libevent, which is used for our rest interface, can use up all of the available file descriptors in a system if too many connections are opened at once. If a new block is connected at the same time and can not be written to disk because there are no file descriptors available, the node crashes. Based on my investigation so far the issue is best solved upstream which means we have to wait for the next release (2.2). In the meantime it would be good if we would warn users of this limitation.

See #11368 for more background.

@maflcko
Copy link
Member

maflcko commented May 22, 2020

Concept ACK

@laanwj
Copy link
Member

laanwj commented May 26, 2020

Concept ACK.

As long as libevent lacks a way to set an upper bound to the number of concurrent incoming connections to a port (it accept()s always), there's no way we can handle this at our side. It's always possible to overwhelm the number of file descriptors (especially when connecting through the loopback interface).

@laanwj
Copy link
Member

laanwj commented May 28, 2020

Is this specific to the REST interface, though? I think any HTTP-related functionality in bitcoin core is affected by this, including RPC requests (when submitted through HTTP)?

@fjahr
Copy link
Contributor Author

fjahr commented May 31, 2020

Is this specific to the REST interface, though? I think any HTTP-related functionality in bitcoin core is affected by this, including RPC requests (when submitted through HTTP)?

That is correct (confirmed with another small test). But it seems like we only got reports from people running into the issue via the REST interface. But maybe they just found the issue with the search and did not bother with the distinction. I added the same comment block at the bottom of the JSON-RPC interface doc. Do any other or better places come to mind where I should put it?

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. I'm pretty sure there isn't a good reason to send several hundred requests at once except for not knowing about a more efficient way to get the same information.

@adamjonas
Copy link
Member

Pinging the thread. For those that approved of the idea (@MarcoFalke, @glozow, @laanwj), are there any concerns with ACKing this?

@fjahr
Copy link
Contributor Author

fjahr commented Dec 16, 2020

FWIW I am watching libevent 2.2 release effort but it still seems pretty far away: libevent/libevent#1094

@maflcko
Copy link
Member

maflcko commented Dec 17, 2020

Could mention that this is fixed in libevent 2.2 (and later)?

@fjahr
Copy link
Contributor Author

fjahr commented Dec 17, 2020

Could mention that this is fixed in libevent 2.2 (and later)?

It isn't fixed by libevent 2.2 automatically. It only adds functionality that allows me then to open a PR that fixes it :)

@maflcko
Copy link
Member

maflcko commented Dec 17, 2020

ACK 5c3eaf9

@maflcko maflcko merged commit 8452f92 into bitcoin:master Dec 17, 2020
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Dec 17, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 17, 2020
5c3eaf9 doc: Add warnings for http interfaces limitations (Fabian Jahr)

Pull request description:

  `libevent`, which is used for our rest interface, can use up all of the available file descriptors in a system if too many connections are opened at once. If a new block is connected at the same time and can not be written to disk because there are no file descriptors available, the node crashes. Based on my investigation so far the issue is best solved upstream which means we have to wait for the next release (2.2). In the meantime it would be good if we would warn users of this limitation.

  See bitcoin#11368 for more background.

ACKs for top commit:
  MarcoFalke:
    ACK 5c3eaf9

Tree-SHA512: 73914538588477ead19068f5832fdcc8e0eb736e51f73b3aca501c93165e5ad634c2511a3fcffff251adcd3efda23a742b48211ad9d3b2a29cdeac17201d06a1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
5c3eaf9 doc: Add warnings for http interfaces limitations (Fabian Jahr)

Pull request description:

  `libevent`, which is used for our rest interface, can use up all of the available file descriptors in a system if too many connections are opened at once. If a new block is connected at the same time and can not be written to disk because there are no file descriptors available, the node crashes. Based on my investigation so far the issue is best solved upstream which means we have to wait for the next release (2.2). In the meantime it would be good if we would warn users of this limitation.

  See bitcoin#11368 for more background.

ACKs for top commit:
  MarcoFalke:
    ACK 5c3eaf9

Tree-SHA512: 73914538588477ead19068f5832fdcc8e0eb736e51f73b3aca501c93165e5ad634c2511a3fcffff251adcd3efda23a742b48211ad9d3b2a29cdeac17201d06a1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 15, 2021
5c3eaf9 doc: Add warnings for http interfaces limitations (Fabian Jahr)

Pull request description:

  `libevent`, which is used for our rest interface, can use up all of the available file descriptors in a system if too many connections are opened at once. If a new block is connected at the same time and can not be written to disk because there are no file descriptors available, the node crashes. Based on my investigation so far the issue is best solved upstream which means we have to wait for the next release (2.2). In the meantime it would be good if we would warn users of this limitation.

  See bitcoin#11368 for more background.

ACKs for top commit:
  MarcoFalke:
    ACK 5c3eaf9

Tree-SHA512: 73914538588477ead19068f5832fdcc8e0eb736e51f73b3aca501c93165e5ad634c2511a3fcffff251adcd3efda23a742b48211ad9d3b2a29cdeac17201d06a1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 16, 2021
5c3eaf9 doc: Add warnings for http interfaces limitations (Fabian Jahr)

Pull request description:

  `libevent`, which is used for our rest interface, can use up all of the available file descriptors in a system if too many connections are opened at once. If a new block is connected at the same time and can not be written to disk because there are no file descriptors available, the node crashes. Based on my investigation so far the issue is best solved upstream which means we have to wait for the next release (2.2). In the meantime it would be good if we would warn users of this limitation.

  See bitcoin#11368 for more background.

ACKs for top commit:
  MarcoFalke:
    ACK 5c3eaf9

Tree-SHA512: 73914538588477ead19068f5832fdcc8e0eb736e51f73b3aca501c93165e5ad634c2511a3fcffff251adcd3efda23a742b48211ad9d3b2a29cdeac17201d06a1
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants