Skip to content

Conversation

hodlinator
Copy link
Contributor

Found while reviewing #201.

@DrahtBot
Copy link

DrahtBot commented Sep 18, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK ryanofsky, Eunovo, theuni

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@hodlinator
Copy link
Contributor Author

Let me know if you see any merit to the Drahtbot recommendation (#213 (comment)):

Its return values -> Return values ["Its" incorrectly refers to the preceding expression; use "Return values" to make the sentence grammatical and clear]

Copy link
Collaborator

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 91606b2. Thanks for the PR! Left some suggestions below, but overall I think this is an improvement.

Let me know if you see any merit to the Drahtbot recommendation (#213 (comment))

Not too important, I think it'd make sense to replace "Its return values" with "The return values." Currently it seems like "its" refers to capnp::RpcSystem which doesn't really make sense.

Comment on lines 33 to 34
if (!fs::exists(path))
throw std::runtime_error{std::string{path} + " is missing, probably needs to be built?"};
Copy link
Collaborator

@ryanofsky ryanofsky Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit "example: Hint at possible problem when binaries are missing" (10d31a6)

This is an improvement, but if this could be updated to just handle errors from the Spawn() calls below and suggest binaries may be missing then, I think that would be better. Better generally to handle errors than try to predict them IMO. And in theory this change could also trigger errors unnecessarily if if binaries were not in the PWD but were in the PATH.

Also would be good to follow bitcoin style and either use a single-line if or add braces around multiline if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, I misremembered your suggestion and ended up moving the error to inside ExecProcess() in util.cpp instead. Let me know if you prefer something closer to your suggestion, no problem.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #213 (comment)

Oof, I misremembered your suggestion and ended up moving the error to inside ExecProcess() in util.cpp instead. Let me know if you prefer something closer to your suggestion, no problem.

This is pretty good. I think your approach makes sense and is a clear improvement. I made my suggestion forgetting that the exec error is only available in the child process, and it would take extra effort to send the errno back to the parent process to use in an exception. Apparently there is a pattern for doing this using a temporary pipe and cloexec but it's more complicated and probably would be better to do in a followup.

@hodlinator hodlinator force-pushed the 2025/09/doc branch 2 times, most recently from c1dae45 to 2024558 Compare September 18, 2025 21:31
@hodlinator hodlinator changed the title example+doc: Clearer errors when attempting to run examples + polished docs util+doc: Clearer errors when attempting to run examples + polished docs Sep 18, 2025
@hodlinator hodlinator marked this pull request as draft September 19, 2025 15:51
@hodlinator hodlinator marked this pull request as ready for review September 20, 2025 22:03
Useful when forgetting to build necessary targets.
* Spell out "class template specialization"
* Uppercase c++
* Typo: require -writing- adding maps
Copy link
Collaborator

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK ec03a96 just addressing previous comments since last review: changing the missing executable check and updating markdown docs. All changes look very good now

Comment on lines 33 to 34
if (!fs::exists(path))
throw std::runtime_error{std::string{path} + " is missing, probably needs to be built?"};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #213 (comment)

Oof, I misremembered your suggestion and ended up moving the error to inside ExecProcess() in util.cpp instead. Let me know if you prefer something closer to your suggestion, no problem.

This is pretty good. I think your approach makes sense and is a clear improvement. I made my suggestion forgetting that the exec error is only available in the child process, and it would take extra effort to send the errno back to the parent process to use in an exception. Apparently there is a pattern for doing this using a temporary pipe and cloexec but it's more complicated and probably would be better to do in a followup.

Copy link
Contributor

@Eunovo Eunovo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ec03a96

Copy link
Contributor

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK ec03a96

@ryanofsky ryanofsky merged commit afcc40b into bitcoin-core:master Oct 2, 2025
8 checks passed
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 2, 2025
…336e98

ec86e4336e98 Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad349 Logging: Pass LogData struct to logging callback
213574ccc43d Logging: reclassify remaining log messages
e4de0412b430 Logging: Break out expensive log messages and classify them as Trace
408874a78fdc Logging: Use new logging macros
67b092d835cd Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf21 Logging: add log levels to mirror Core's
463a8296d188 Logging: Disable moving or copying Logger
83a2e10c0b03 Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc8c Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f514 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1e8 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db669628387 test In|Out parameter
29cf2ada75ea test default PassField impl handles output parameters
1238170f68e8 test: simultaneous IPC calls using same thread
eb069ab75d83 Fix crash on simultaneous IPC calls using the same thread
ec03a9639ab5 doc: Precision and typos
2b4348193551 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9c9 util: Add helpful error message when failing to execute file

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: ec86e4336e986a02b08ab12f7eea9f74551c5bef
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 2, 2025
…336e98

ec86e4336e98 Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad349 Logging: Pass LogData struct to logging callback
213574ccc43d Logging: reclassify remaining log messages
e4de0412b430 Logging: Break out expensive log messages and classify them as Trace
408874a78fdc Logging: Use new logging macros
67b092d835cd Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf21 Logging: add log levels to mirror Core's
463a8296d188 Logging: Disable moving or copying Logger
83a2e10c0b03 Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc8c Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f514 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1e8 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db669628387 test In|Out parameter
29cf2ada75ea test default PassField impl handles output parameters
1238170f68e8 test: simultaneous IPC calls using same thread
eb069ab75d83 Fix crash on simultaneous IPC calls using the same thread
ec03a9639ab5 doc: Precision and typos
2b4348193551 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9c9 util: Add helpful error message when failing to execute file
47d79db8a552 Merge bitcoin-core/libmultiprocess#201: bug: fix mptest hang, ProxyClient<Thread> deadlock in disconnect handler
f15ae9c9b9fb Merge bitcoin-core/libmultiprocess#211: Add .gitignore
4a269b21b8c8 bug: fix ProxyClient<Thread> deadlock if disconnected as IPC call is returning
85df96482c49 Use try_emplace in SetThread instead of threads.find
ca9b380ea91a Use std::optional in ConnThreads to allow shortening locks
9b0799113557 doc: describe ThreadContext struct and synchronization requirements
d60db601ed9b proxy-io.h: add Waiter::m_mutex thread safety annotations
4e365b019a9f ci: Use -Wthread-safety not -Wthread-safety-analysis
15d7bafbb001 Add .gitignore
fe1cd8c76131 Merge bitcoin-core/libmultiprocess#208: ci: Test minimum cmake version in olddeps job
b713a0b7bfbc Merge bitcoin-core/libmultiprocess#207: ci: output CMake version in CI script
0f580397c913 ci: Test minimum cmake version in olddeps job
d603dcc0eef0 ci: output CMake version in CI script

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: ec86e4336e986a02b08ab12f7eea9f74551c5bef
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 7, 2025
…e87da0

f4344ae87da0 Merge bitcoin-core/libmultiprocess#222: test, ci: Fix threadsanitizer errors in mptest
73d22ba2e930 test: Fix tsan race in thread busy test
b74e1bba014d ci: Use tsan-instrumented cap'n proto in sanitizers job
c332774409ad test: Fix failing exception check in new thread busy test
ca3c05d56709 test: Use KJ_LOG instead of std::cout for logging
7eb1da120ab6 ci: Use tsan-instrumented libcxx in sanitizers job
ec86e4336e98 Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad349 Logging: Pass LogData struct to logging callback
213574ccc43d Logging: reclassify remaining log messages
e4de0412b430 Logging: Break out expensive log messages and classify them as Trace
408874a78fdc Logging: Use new logging macros
67b092d835cd Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf21 Logging: add log levels to mirror Core's
463a8296d188 Logging: Disable moving or copying Logger
83a2e10c0b03 Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc8c Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f514 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1e8 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db669628387 test In|Out parameter
29cf2ada75ea test default PassField impl handles output parameters
1238170f68e8 test: simultaneous IPC calls using same thread
eb069ab75d83 Fix crash on simultaneous IPC calls using the same thread
ec03a9639ab5 doc: Precision and typos
2b4348193551 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9c9 util: Add helpful error message when failing to execute file

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: f4344ae87da0375ca32b9967b3c0ac381a3349d2
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 7, 2025
…696490

a4f929696490 Merge bitcoin-core/libmultiprocess#224: doc: fix typos
f4344ae87da0 Merge bitcoin-core/libmultiprocess#222: test, ci: Fix threadsanitizer errors in mptest
1434642b3804 doc: fix typos
73d22ba2e930 test: Fix tsan race in thread busy test
b74e1bba014d ci: Use tsan-instrumented cap'n proto in sanitizers job
c332774409ad test: Fix failing exception check in new thread busy test
ca3c05d56709 test: Use KJ_LOG instead of std::cout for logging
7eb1da120ab6 ci: Use tsan-instrumented libcxx in sanitizers job
ec86e4336e98 Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad349 Logging: Pass LogData struct to logging callback
213574ccc43d Logging: reclassify remaining log messages
e4de0412b430 Logging: Break out expensive log messages and classify them as Trace
408874a78fdc Logging: Use new logging macros
67b092d835cd Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf21 Logging: add log levels to mirror Core's
463a8296d188 Logging: Disable moving or copying Logger
83a2e10c0b03 Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc8c Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f514 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1e8 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db669628387 test In|Out parameter
29cf2ada75ea test default PassField impl handles output parameters
1238170f68e8 test: simultaneous IPC calls using same thread
eb069ab75d83 Fix crash on simultaneous IPC calls using the same thread
ec03a9639ab5 doc: Precision and typos
2b4348193551 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9c9 util: Add helpful error message when failing to execute file

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: a4f92969649018ca70f949a09148bccfeaecd99a
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 7, 2025
…696490

a4f929696490 Merge bitcoin-core/libmultiprocess#224: doc: fix typos
f4344ae87da0 Merge bitcoin-core/libmultiprocess#222: test, ci: Fix threadsanitizer errors in mptest
1434642b3804 doc: fix typos
73d22ba2e930 test: Fix tsan race in thread busy test
b74e1bba014d ci: Use tsan-instrumented cap'n proto in sanitizers job
c332774409ad test: Fix failing exception check in new thread busy test
ca3c05d56709 test: Use KJ_LOG instead of std::cout for logging
7eb1da120ab6 ci: Use tsan-instrumented libcxx in sanitizers job
ec86e4336e98 Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad349 Logging: Pass LogData struct to logging callback
213574ccc43d Logging: reclassify remaining log messages
e4de0412b430 Logging: Break out expensive log messages and classify them as Trace
408874a78fdc Logging: Use new logging macros
67b092d835cd Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf21 Logging: add log levels to mirror Core's
463a8296d188 Logging: Disable moving or copying Logger
83a2e10c0b03 Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc8c Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f514 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1e8 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db669628387 test In|Out parameter
29cf2ada75ea test default PassField impl handles output parameters
1238170f68e8 test: simultaneous IPC calls using same thread
eb069ab75d83 Fix crash on simultaneous IPC calls using the same thread
ec03a9639ab5 doc: Precision and typos
2b4348193551 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9c9 util: Add helpful error message when failing to execute file
47d79db8a552 Merge bitcoin-core/libmultiprocess#201: bug: fix mptest hang, ProxyClient<Thread> deadlock in disconnect handler
f15ae9c9b9fb Merge bitcoin-core/libmultiprocess#211: Add .gitignore
4a269b21b8c8 bug: fix ProxyClient<Thread> deadlock if disconnected as IPC call is returning
85df96482c49 Use try_emplace in SetThread instead of threads.find
ca9b380ea91a Use std::optional in ConnThreads to allow shortening locks
9b0799113557 doc: describe ThreadContext struct and synchronization requirements
d60db601ed9b proxy-io.h: add Waiter::m_mutex thread safety annotations
4e365b019a9f ci: Use -Wthread-safety not -Wthread-safety-analysis
15d7bafbb001 Add .gitignore
fe1cd8c76131 Merge bitcoin-core/libmultiprocess#208: ci: Test minimum cmake version in olddeps job
b713a0b7bfbc Merge bitcoin-core/libmultiprocess#207: ci: output CMake version in CI script
0f580397c913 ci: Test minimum cmake version in olddeps job
d603dcc0eef0 ci: output CMake version in CI script

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: a4f92969649018ca70f949a09148bccfeaecd99a
Sjors added a commit to Sjors/sv2-tp that referenced this pull request Oct 7, 2025
a4f9296964 Merge bitcoin-core/libmultiprocess#224: doc: fix typos
f4344ae87d Merge bitcoin-core/libmultiprocess#222: test, ci: Fix threadsanitizer errors in mptest
1434642b38 doc: fix typos
73d22ba2e9 test: Fix tsan race in thread busy test
b74e1bba01 ci: Use tsan-instrumented cap'n proto in sanitizers job
c332774409 test: Fix failing exception check in new thread busy test
ca3c05d567 test: Use KJ_LOG instead of std::cout for logging
7eb1da120a ci: Use tsan-instrumented libcxx in sanitizers job
ec86e4336e Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad3 Logging: Pass LogData struct to logging callback
213574ccc4 Logging: reclassify remaining log messages
e4de0412b4 Logging: Break out expensive log messages and classify them as Trace
408874a78f Logging: Use new logging macros
67b092d835 Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf Logging: add log levels to mirror Core's
463a8296d1 Logging: Disable moving or copying Logger
83a2e10c0b Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f5 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db6696283 test In|Out parameter
29cf2ada75 test default PassField impl handles output parameters
1238170f68 test: simultaneous IPC calls using same thread
eb069ab75d Fix crash on simultaneous IPC calls using the same thread
ec03a9639a doc: Precision and typos
2b43481935 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9 util: Add helpful error message when failing to execute file

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: a4f92969649018ca70f949a09148bccfeaecd99a
fanquake added a commit to bitcoin/bitcoin that referenced this pull request Oct 10, 2025
0f01e15 Squashed 'src/ipc/libmultiprocess/' changes from 47d79db8a552..a4f929696490 (Ryan Ofsky)

Pull request description:

  Includes:

  - bitcoin-core/libmultiprocess#213
  - bitcoin-core/libmultiprocess#214
  - bitcoin-core/libmultiprocess#221
  - bitcoin-core/libmultiprocess#220
  - bitcoin-core/libmultiprocess#222
  - bitcoin-core/libmultiprocess#224

  The change bitcoin-core/libmultiprocess#220 is needed to support #33517 and fix poor performance in some cases caused by slow logging.

  The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh)

ACKs for top commit:
  Sjors:
    utACK eda91b0
  theuni:
    utACK eda91b0.

Tree-SHA512: 43c2f47bb95f56181f3ce8cf41380e83b1c00b363a7c732d735a9115ed251fa2c2c9bd096d9be011e47503047a740b2e05c9a79d7e4170a4de9c20ad0de3e501
Sjors added a commit to Sjors/sv2-tp that referenced this pull request Oct 10, 2025
a4f9296964 Merge bitcoin-core/libmultiprocess#224: doc: fix typos
f4344ae87d Merge bitcoin-core/libmultiprocess#222: test, ci: Fix threadsanitizer errors in mptest
1434642b38 doc: fix typos
73d22ba2e9 test: Fix tsan race in thread busy test
b74e1bba01 ci: Use tsan-instrumented cap'n proto in sanitizers job
c332774409 test: Fix failing exception check in new thread busy test
ca3c05d567 test: Use KJ_LOG instead of std::cout for logging
7eb1da120a ci: Use tsan-instrumented libcxx in sanitizers job
ec86e4336e Merge bitcoin-core/libmultiprocess#220: Add log levels and advertise them to users via logging callback
515ce93ad3 Logging: Pass LogData struct to logging callback
213574ccc4 Logging: reclassify remaining log messages
e4de0412b4 Logging: Break out expensive log messages and classify them as Trace
408874a78f Logging: Use new logging macros
67b092d835 Logging: Disable logging if messsage level is less than the requested level
d0a1ba7ebf Logging: add log levels to mirror Core's
463a8296d1 Logging: Disable moving or copying Logger
83a2e10c0b Logging: Add an EventLoop constructor to allow for user-specified log options
58cf47a7fc Merge bitcoin-core/libmultiprocess#221: test default PassField impl handles output parameters
db03a663f5 Merge bitcoin-core/libmultiprocess#214: Fix crash on simultaneous IPC calls using the same thread
afcc40b0f1 Merge bitcoin-core/libmultiprocess#213: util+doc: Clearer errors when attempting to run examples + polished docs
6db6696283 test In|Out parameter
29cf2ada75 test default PassField impl handles output parameters
1238170f68 test: simultaneous IPC calls using same thread
eb069ab75d Fix crash on simultaneous IPC calls using the same thread
ec03a9639a doc: Precision and typos
2b43481935 doc: Where possible, remove links to ryanofsky/bitcoin/
286fe469c9 util: Add helpful error message when failing to execute file

git-subtree-dir: src/ipc/libmultiprocess
git-subtree-split: a4f92969649018ca70f949a09148bccfeaecd99a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants