Repository navigation
ipc: support per-address max-connections options on -ipcbind - #35037
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible places where named args for integral literals may be used (e.g.
2026-09-30 12:42:23 |
065bfe9 to
788107e
Compare
788107e to
9a30318
Compare
|
Concept ACK. Looks like suggestions from #35036 (comment) apply here too (sorry, saw that PR first in my inbox). IMO this is a better alternative to adding a new |
8a2fa52 to
57a0a29
Compare
|
Thanks for the review @ryanofsky I pushed updates based on your review here as well
|
|
Concept ACK I agree with Ryanofsky. I think this approach seems more reasonable than #34978, even though both can work and both make sense this seems cleaner. I think it makes sense to go with this approach instead of adding the |
|
cc @Sjors |
2309ca9 to
50fba48
Compare
|
Addressed nits and suggestions by @Eunovo |
|
re-ACK 39b1c5a Nice changes |
|
Removed a stale comment 9be61a9#diff-5768699cb2773eff506c411cdb8ca5c1a5fddc6e4cc82a9cfc64b2c0f4f85e52R286 in the |
|
reACK 78a1251 |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK 78a1251. Changes since last review were moving some changes to an earlier commit, adding ipc_fds constant, adding assert, updating tests and release notes.
(Previously discussed ideas I think would still be good as followups: making the parse method virtual #35037 (comment) so we are not linking ipc code into the common library, and making parsing code more compact and generic #35037 (comment))
| size_t next{0}; | ||
| while (next <= options_view.size()) { | ||
| const size_t end{options_view.find(',', next)}; | ||
| const std::string_view option{ | ||
| options_view.substr(next, end - next)}; | ||
|
|
||
| if (option.empty()) { | ||
| return util::Error{Untranslated("Empty socket option")}; | ||
| } | ||
|
|
||
| const size_t equals{option.find('=')}; | ||
| const std::string_view name{option.substr(0, equals)}; | ||
| const std::string_view value{ | ||
| equals == std::string_view::npos ? std::string_view{} : option.substr(equals + 1)}; | ||
|
|
||
| if (name != "max-connections") { | ||
| return util::Error{Untranslated(strprintf("Unknown socket option '%s'", name))}; | ||
| } | ||
| if (value.empty()) { | ||
| return util::Error{Untranslated("Missing value for max-connections option")}; | ||
| } | ||
|
|
||
| int64_t parsed_value{-1}; | ||
| const auto [last, ec]{std::from_chars(value.data(), value.data() + value.size(), parsed_value)}; | ||
|
|
||
| if (ec != std::errc{} || last != value.data() + value.size()) { | ||
| return util::Error{Untranslated("Invalid max-connections value '" + std::string{value} + "'")}; | ||
| } | ||
| if (parsed_value < 1) { | ||
| return util::Error{Untranslated("max-connections must be at least 1")}; | ||
| } | ||
| if (parsed_value > static_cast<int64_t>(ipc::MAX_CONNECTIONS)) { | ||
| return util::Error{Untranslated("max-connections must be at most " + util::ToString(ipc::MAX_CONNECTIONS))}; | ||
| } | ||
|
|
||
| listen_address.max_connections = static_cast<size_t>(parsed_value); | ||
|
|
||
| if (end == std::string_view::npos) break; | ||
| next = end + 1; | ||
| } |
|
Thanks for the review @sedited . Addressed comments made
|
ryanofsky
left a comment
There was a problem hiding this comment.
Code review 4ac08a6. Changes since last review: parsing now uses SplitString and ParseIntOption, the release notes mention URL decoding, and the help text is reworded. The parsing changes look good, but the new help text has unformatted %d placeholders (comment below), so I'd re-ACK once that's fixed.
Parse optional max-connections socket options from -ipcbind values through interfaces::Ipc, returning ipc::ListenAddress values that keep each listener address and connection limit together. Use comma delimited socket options to avoid ambiguity with paths containing colons, and validate each configured limit before adding it to IPC file descriptor reservations.
Add IPC coverage for local listener capacity over unix sockets. Verify a listener at capacity resumes accepting after a disconnect, check separate listeners enforce their limits independently, and cover parser and aggregate file descriptor limit boundaries.
|
friendly ping @ViniciusCestarii @xyzconstant |
|
Post-merge ACK 856f9ea |
The framework’s current limit of 76 comes from the NetBSD fd budget before ipc reservations bitcoin/test/functional/test_framework/util.py Lines 573 to 574 in 4bacf21 Which is why I think we have this test failing. Should we include the 17 descriptors for a default ipc listener in that calculation and lower the test default to 59, or would we prefer adjusting only ipc enabled tests? Wondering if lowering It to 59 would cause issues for other tests |

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.This keeps the connection limit attached to each IPC listener instead of introducing a global
-ipcmaxconnectionsoption (#34978). A global option would not allow different limits for different-ipcbindaddresses, and the inline option format can be extended in the future with additional options.