Merge #20024: init: Fix incorrect warning "Reducing -maxconnections from N to N-1, because of system limitations"

ea93bbeb26 init: Fix incorrect warning "Reducing -maxconnections from N to N-1, because of system limitations" (practicalswift)

Pull request description:

  Fix incorrect warning `Reducing -maxconnections from N to N-1, because of system limitations`.

  Before this patch (only the first warning is correct):

  ```
  $ src/bitcoind -maxconnections=10000000 | grep Warning
  2020-09-26T01:23:45Z Warning: Reducing -maxconnections from 10000000 to 1048417, because of system limitations.

  $ src/bitcoind -maxconnections=1000000 | grep Warning
  2020-09-26T01:23:45Z Warning: Reducing -maxconnections from 1000000 to 999999, because of system limitations.

  $ src/bitcoind -maxconnections=100000 | grep Warning
  2020-09-26T01:23:45Z Warning: Reducing -maxconnections from 100000 to 99999, because of system limitations.

  $ src/bitcoind -maxconnections=10000 | grep Warning
  2020-09-26T01:23:45Z Warning: Reducing -maxconnections from 10000 to 9999, because of system limitations.

  $ src/bitcoind -maxconnections=1000 | grep Warning
  2020-09-26T01:23:45Z Warning: Reducing -maxconnections from 1000 to 999, because of system limitations.

  $ src/bitcoind -maxconnections=100 | grep Warning
  [no warning]
  ```

  After this patch (no incorrect warnings):

  ```
  $ src/bitcoind -maxconnections=10000000 | grep Warning
  2020-09-26T01:23:45Z Warning: Reducing -maxconnections from 10000000 to 1048417, because of system limitations.

  $ src/bitcoind -maxconnections=1000000 | grep Warning
  [no warning]

  $ src/bitcoind -maxconnections=100000 | grep Warning
  [no warning]

  $ src/bitcoind -maxconnections=10000 | grep Warning
  [no warning]

  $ src/bitcoind -maxconnections=1000 | grep Warning
  [no warning]

  $ src/bitcoind -maxconnections=100 | grep Warning
  [no warning]
  ```

ACKs for top commit:
  n-thumann:
    tACK ea93bbeb26, Ran on other systems running Debian 10.5 (4.19.0-8-amd64) and Debian bullseye/sid (5.3.0-1-amd64) and was able to reproduce the issue exactly as you described above on both of them. After applying your patch the issue is fixed ✌️
  laanwj:
    Code review ACK ea93bbeb26
  theStack:
    tACK ea93bbeb26

Tree-SHA512: 9b0939a1a51fdf991d11024a5d20b4f39cab1a80320b799a1d24d0250aa059666bcb1ae6dd79c941c2f2686f07f59fc0f6618b5746aa8ca6011fdd202828a930
pull/679/head
Wladimir J. van der Laan 4 years ago
commit 7aa94569ce
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

@ -1039,7 +1039,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
// Trim requested connection counts, to fit into system limitations // Trim requested connection counts, to fit into system limitations
// <int> in std::min<int>(...) to work around FreeBSD compilation issue described in #2695 // <int> in std::min<int>(...) to work around FreeBSD compilation issue described in #2695
nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS); nFD = RaiseFileDescriptorLimit(nMaxConnections + MIN_CORE_FILEDESCRIPTORS + MAX_ADDNODE_CONNECTIONS + nBind);
#ifdef USE_POLL #ifdef USE_POLL
int fd_max = nFD; int fd_max = nFD;
#else #else

Loading…
Cancel
Save