Repository navigation
Conversation
Before adding IPC FD reservation, verify that the existing "file descriptors available" log line fires when the node starts with -ipcbind=unix. This establishes a baseline; the following commits rename this helper to test_ipcmaxconnections and extend it to assert the new reservation log line.
When -ipcbind is used, the node opens one listening socket FD per bound address and accepts concurrent IPC connections. Neither was previously accounted for in min_required_fds, meaning IPC-heavy workloads could silently exhaust available file descriptors at unpredictable moments. Add -ipcmaxconnections (default: 16, mirroring -rpcworkqueue) so operators can control how many FDs are reserved for accepted IPC connections. Add ipc_bind to account for the listening socket FDs opened per -ipcbind address, which were previously unaccounted for. Emit a warning when -ipcmaxconnections is set without -ipcbind. Log the total IPC FD reservation at startup so operators can verify it. Suggested by Sjors in bitcoin#32297 (comment).
…ging Add -ipcmaxconnections startup checks and assert the new IPC FD reservation log line fires with correct values. With -ipcmaxconnections=8, the node logs "Reserving 9 file descriptors for IPC (1 listening sockets, 8 accepted connections)", demonstrating that this PR increases the reserved FD count.
Replace the global -ipcmaxconnections option with per-address max-connections parsing on -ipcbind values. Update init argument documentation, parse and validate :max-connections=<n> suffixes, and reserve file descriptors by summing accepted-connection limits across all configured IPC listeners. Reject ambiguous syntax like unix:max-connections=8 so option-looking input is not silently treated as a literal socket path. Extend IPC parser coverage and functional startup coverage to check the new -ipcbind forms, FD reservation logging, and init errors for invalid max-connections values.
Thread optional per-address max-connections values through the Bitcoin IPC stack and the vendored libmultiprocess listener implementation. Update interfaces::Ipc and ipc::Protocol listen methods to accept an optional connection limit, pass parsed -ipcbind limits from init, and use the vendored ListenConnections(..., max_connections) support so each listener stops accepting new IPC connections after reaching its local cap and resumes accepting after a disconnect.
Add a Bitcoin-side IPC test covering the local listener limit behavior through ipc::Process and ipc::Protocol over a real unix socket. The new test starts a listener with max_connections=1, verifies the first client is served immediately, checks that a second client remains blocked while the first connection stays open, and then confirms the second client becomes usable after the first disconnects. This keeps the downstream draft from relying only on vendored libmultiprocess tests and startup log assertions.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. LLM Linter (✨ experimental)Possible typos and grammar issues:
Possible places where named args for integral literals may be used (e.g.
2026-04-09 13:08:14 |
|
Concept ACK. Reactions on the implementation:
Do you want to maybe leave this open as a draft since it depends on bitcoin-core/libmultiprocess#269? EDIT: Looks like this was replaced by #35037 (same code changes just rebased with squashed commits and small test change) |
Right, I replaced this with #35037 after rebasing onto master, cleaning the history down to 3 commits, and making a small functional test adjustments. Will apply the suggestions to that PR instead. Thanks |
This is a draft follow-up to #34978 to make the per-address IPC connection-limit approach concrete.
The branch extends
-ipcbindto accept:max-connections=<n>options, for example-ipcbind=unix::max-connections=8or-ipcbind=unix:/custom/path:max-connections=8, instead of introducing a separate global-ipcmaxconnectionsoption.It also vendors the local listener limit support needed in
libmultiprocessand threads the parsed per-address limit through toListenConnections()so each listener can stop accepting new IPC connections after reaching its local cap and resume accepting after a disconnect.The draft includes:
-ipcbindmax-connections and invalid inputsmax_connections=1, a second client only becomes usable after the first disconnectsThis is intended to help evaluate the per-address approach downstream against the global-limit direction in #34978.