mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-07-13 07:29:34 +02:00
init: clamp fd limits to int
When setting the fd limit to 1 >> 31, the node fails to start: ulimit -n 214748364 build/bin/bitcoind Error: Not enough file descriptors available. -2147483648 available, 160 required. Similar to the previous commit, this is fixed by capping the limit to std::numeric_limits<int>::max(). Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>
This commit is contained in:
@@ -348,6 +348,15 @@ class InitTest(BitcoinTestFramework):
|
||||
self.log.info("Testing node startup with RLIM_INFINITY fd limit")
|
||||
self.restart_node_with_fd_limit(self.RLIM_INFINITY)
|
||||
|
||||
def init_rlimit_large_test(self):
|
||||
"""Test that bitcoind starts correctly when the soft RLIMIT_NOFILE limit is above INT_MAX."""
|
||||
if self.RLIM_INFINITY is None:
|
||||
self.log.info("Skipping: resource module not available")
|
||||
return
|
||||
|
||||
self.log.info("Testing node startup with fd limit above INT_MAX")
|
||||
self.restart_node_with_fd_limit(1 << 31)
|
||||
|
||||
def run_test(self):
|
||||
self.init_pid_test()
|
||||
self.init_stress_test_interrupt()
|
||||
@@ -355,6 +364,7 @@ class InitTest(BitcoinTestFramework):
|
||||
self.break_wait_test()
|
||||
self.init_empty_test()
|
||||
self.init_rlimit_test()
|
||||
self.init_rlimit_large_test()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user