Restart node 1 with a given soft RLIMIT_NOFILE. Skips if the limit cannot be set.
(self, limit)
| 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.""" |
no test coverage detected