#34978 init: reserve file descriptors for IPC connections
https://github.com/bitcoin/bitcoin/pull/34978 · · +87/-4 in 3 files, 3 commits · labels: Needs rebase · draft
Goal
- Prevent unexpected crashes or socket errors from file descriptor exhaustion when IPC is enabled
This pull request updates startup parameter handling in `src/init.cpp` to reserve file descriptors for IPC listening sockets and incoming connections when `-ipcbind` is enabled. It introduces a `-ipcmaxconnections` option (defaulting to 16) and adds a dedicated functional test `interface_ipc_init.py` verifying the reservation logging.
Problem: When `-ipcbind` is used, the listening socket and accepted connections are not accounted for in `min_required_fds`. High-volume IPC connections can exhaust the node's available file descriptors, leading to unpredictable runtime failures.
Category: IPC / multiprocess (#20 of 20)
P3 · stability
- P3 because prevents unpredictable node failures from running out of file descriptors
- IPC remains an experimental feature and this only reserves descriptors without enforcing caps
Prevents potential node crashes or socket errors resulting from file descriptor exhaustion when IPC is enabled. As Sjors noted, 'the error for running out file descriptors is presumably confusing, and it will happen at unpredictable moments depending on how many RPC, P2P and IPC connections are active.' However, IPC remains experimental and the PR only reserves descriptors rather than strictly enforcing limits.
Membership: Modifies init configuration and startup FD accounting specifically for -ipcbind sockets, adding tests in test/functional/interface_ipc_init.py.
Factors: security/stability 1, bug 1, performance 0, user value 1, leverage 1
Reviewability: Stale: Needs rebase
- Review is not worthwhile because the author marked it draft in favor of #35037
- Needs rebase and has merge conflicts
The PR has merge conflicts, needs a rebase, has had no author activity for 84 days, and was explicitly marked draft by the author in favor of #35037.
Author status: silent since 2026-06-25, converted PR to draft in favor of #35037
Open concerns:
- Architectural dispute over configuration: ryanofsky prefers per-address connection limits specified directly on `-ipcbind` (pursued in #35037) rather than introducing a global `-ipcmaxconnections` option.
- This PR only reserves file descriptors at startup without enforcing connection caps in the accept loop (which requires libmultiprocess changes).
Resolved concerns:
- Renamed option from `-unixmaxconnections` back to `-ipcmaxconnections` to remain consistent with `-ipcbind` and `-ipcconnect`.
- Fixed handling of `-noipcbind` negation when checking bound sockets.
- Moved startup logging tests out of `interface_ipc_cli.py` into a dedicated `interface_ipc_init.py` test.
Agreement: Disputed
- General agreement that IPC file descriptors need accounting (Sjors, kevkevinpal, w0xlt, sedited)
- Architectural objection preferring per-address limits over a global configuration option (ryanofsky)
- Author marked as draft to pursue the alternative approach (enirox001)
Disputed: ryanofsky prefers per-address limits on -ipcbind (#35037) over a global -ipcmaxconnections option; author marked draft in favor of #35037
While reviewers agree that IPC file descriptors should be accounted for, ryanofsky advised against adding a global command-line option in favor of per-address limits. The author moved the PR to draft to pursue that alternative in #35037, though sedited noted per-bind limits might be overkill.
- Concept ACK from Sjors, kevkevinpal, w0xlt, and sedited
- ryanofsky: 'I don't think it would be good to add a new -ipcmaxconnections option that's global and independent from actual IPC interfaces and endpoints... Would suggest changing this PR from ready to draft state'
- enirox001: 'Marking this PR to draft in favor of #35037'
- sedited: 'The per-bind accounting seems fine too, but isn't that a bit overkill?'
Review verdicts (DrahtBot): 0 (+1)
- Stale ACK: ryanofsky
- Concept ACK: Sjors, kevkevinpal, w0xlt, sedited
Dependencies
Enables:
Files
61 lines under test/bench/ci.
- test/functional/interface_ipc_init.py +60/-0
- src/init.cpp +26/-4
- test/functional/test_runner.py +1/-0
Card
This PR reserves file descriptors at startup for IPC listening sockets and incoming connections by introducing a `-ipcmaxconnections` option. Currently, `-ipcbind` does not account for these descriptors in `min_required_fds`, risking unpredictable socket errors under heavy IPC workloads. While reviewers support fixing the FD reservation, ryanofsky objected to adding a global command-line option in favor of per-address limits on `-ipcbind`. Consequently, the author marked this PR as draft in favor of #35037, and the PR now needs a rebase.