MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / restart_node_with_fd_limit

Method restart_node_with_fd_limit

test/functional/feature_init.py:331–345  ·  view source on GitHub ↗

Restart node 1 with a given soft RLIMIT_NOFILE. Skips if the limit cannot be set.

(self, limit)

Source from the content-addressed store, hash-verified

329 self.restart_node(1, option)
330
331 def restart_node_with_fd_limit(self, limit):
332 """Restart node 1 with a given soft RLIMIT_NOFILE. Skips if the limit cannot be set."""
333 import resource
334 soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
335 try:
336 resource.setrlimit(resource.RLIMIT_NOFILE, (limit, hard))
337 except (ValueError, OSError):
338 self.log.info(f"Skipping rlimit test: cannot set soft limit (hard={hard})")
339 return
340 try:
341 self.restart_node(1)
342 self.log.debug(f"Node started successfully with RLIM_INFINITY limit (soft={limit})")
343 finally:
344 resource.setrlimit(resource.RLIMIT_NOFILE, (soft, hard))
345 self.log.debug(f"Restored previous RLIMIT_NOFILE limits (soft={soft}, hard={hard})")
346
347 def init_rlimit_test(self):
348 """Test that bitcoind starts correctly when the soft RLIMIT_NOFILE limit is RLIM_INFINITY."""

Callers 2

init_rlimit_testMethod · 0.95

Calls 2

infoMethod · 0.80
restart_nodeMethod · 0.45

Tested by

no test coverage detected