Repository navigation
Try to increase file descriptor rlimit if necessary - #2568
Conversation
|
We should probably be clamping max connections at FD_SETSIZE-MIN_CORE_FILEDESCRIPTORS otherwise you get fun stuff like select becoming crashy. |
|
ACK |
1 similar comment
|
ACK |
|
@gavinandresen Have you tested whether this compiles on OSX? |
|
@sipa : yes, compiles fine, unit tests run, bitcoind -testnet runs on OSX |
|
@gavinandresen can you try running (for i in {1..220000} ; do export bh= On a OSX mainnet node with this patch and txindex=1 when you get a chance? It should causes about 500 FDs to be used. |
|
Refactored the code into a RaiseFileDescriptorLimit in util, and added a windows implementation. Minimal test plan:
I'd like to see at least some proof that this works on Windows on OSX. For Windows, #2569 is needed to get more than 63 connections. |
There was a problem hiding this comment.
Is this correct? MSDN says: "Up to 2,048 files can be open simultaneously at the lowio level (that is, opened and accessed by means of the _open, _read, _write, and so forth family of I/O functions). Up to 512 files can be open simultaneously at the stdio level (that is, opened and accessed by means of the fopen, fgetc, fputc, and so forth family of functions). The limit of 512 open files at the stdio level can be increased to a maximum of 2,048 by means of the _setmaxstdio function."
Is the 2048 limit on a lowio level or stdio level? If the later we need to call _setmaxstdio(2048) here?
http://msdn.microsoft.com/en-us/library/6e3b887c.aspx
There was a problem hiding this comment.
It's a bit fuzzy, as things don't match exactly, but file descriptors correspond to the lowio level. However, the win32 leveldb implementation uses kernel calls directly, bypassing both stdio and lowio, so we don't actually need to count those. On the other hand, for block and undo files, we do use the stdio level...
As the default can be too low, especially on OSX.
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/ba29a5590bc4479d74454f0b9fdaf007d9d80221 for binaries and test log. |
|
ACK. @gmaxwell : successfully ran (a modified version of) your stress test on OSX with this patch and -txindex=1. |
|
ACK. |
Try to increase file descriptor rlimit if necessary
Try to increase file descriptor rlimit if necessary
As the default can be too low, especially on OSX.