Skip to content

WIP: Add test coverage for ConnectStream#298

Draft
xyzconstant wants to merge 1 commit into
bitcoin-core:masterfrom
xyzconstant:add-coverage-for-connect-stream
Draft

WIP: Add test coverage for ConnectStream#298
xyzconstant wants to merge 1 commit into
bitcoin-core:masterfrom
xyzconstant:add-coverage-for-connect-stream

Conversation

@xyzconstant

Copy link
Copy Markdown
Contributor

ref: #183

Opening this draft to make it visible to more reviewers. Quoting my comment in the issue as well:

I've added tests for four scenarios:

  1. Attempting to use an fd associated with a server that has already been disconnected results in a crash with: "IPC client method called after disconnect".
  2. Attempting to use an fd associated with a server that disconnects immediately after the first recv(), the outcome will either be crashing with "IPC client method called after disconnect" or "IPC client method call interrupted by disconnect." This behavior seems to depend on whether the recv() call successfully reads the entirety of what is likely Capnp’s bootstrap request or only a portion of it.
  3. Attempting to use an fd associated with a server that disconnects after a second recv(), the process crashes with "IPC client method call interrupted by disconnect."
  4. Attempting to use an fd associated with a server that indefinitely calls recv() in a while loop results in the test getting stuck at this line:

thread_context.waiter->wait(lock, [&done]() { return done; });

It’s important to note that all of these cases call FooInterface::initThreadMap() to invoke clientInvoke(), as ConnectStream() on its own won't trigger any libmultiprocess request if there's not a construct() method available in the Init interface.

I'm looking for more ideas for testing ConnectStream.

ref: bitcoin-core#183

This commit introduced new test cases to demonstrate how
`ConnectStream` behaves under a few scenarios and improve coverage for it.
@DrahtBot

DrahtBot commented Jun 24, 2026

Copy link
Copy Markdown

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

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #288 (Create support branch for CI scripts, documentation, and examples by ryanofsky)
  • #269 (proxy: add local connection limit to ListenConnections by enirox001)

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 typos and grammar issues:

  • Cap N' Proto -> Cap'n Proto [the project name is misspelled]

2026-06-24 03:54:02

@xyzconstant xyzconstant changed the title WIP: Add test coverage for ConnectStream WIP: Add test coverage for ConnectStream Jun 24, 2026
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.

2 participants