Skip to content

fix(pact_ffi): run the verification on a thread with an 8 MiB stack - #32

Open
YOU54F wants to merge 18 commits into
masterfrom
fix/verifier-stack-size
Open

YOU54F wants to merge 18 commits into
masterfrom
fix/verifier-stack-size

Conversation

@YOU54F

@YOU54F YOU54F commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Summary

pactffi_verifier_execute ran the whole verification on the calling thread. Threads created by Go or the JVM on musl (Alpine) get musl's 128 KiB default stack, which the verification overflows, so the process crashes with SIGSEGV. pact-go provider tests on Alpine failed intermittently, and almost always under -race.

The verification now runs on a scoped thread with an 8 MiB stack, on every platform, and the caller waits for it. If that thread can't be started, it falls back to the calling thread. The thread-local test run ID is carried over, so log callbacks keep working. On glibc, macOS and Windows the behaviour is unchanged apart from the extra thread.

Testing

  • A new test, pactffi_verifier_execute_does_not_depend_on_the_callers_stack_size, calls the verifier from a 128 KiB thread. Without the fix it aborts with a stack overflow on any platform.
  • cargo test -p pact_ffi --lib verifier passes after rebasing on master.
  • Before the rebase, on Alpine arm64: with a libpact_ffi.so built from this patch, the pact-go provider tests passed 10/10 on cgo, purego and goffi, with and without -race. Without the patch they passed between 0 and 5 of 10.

🤖 Generated with Claude Code

ChangkeunJ and others added 18 commits October 26, 2026 18:43
pact_verifier builds pact_matching with default-features = false and
never enabled form_urlencoded, so apply_body_generators took the
#[cfg(not(feature = "form_urlencoded"))] branch and sent form bodies to
the provider as recorded. Add a form_urlencoded feature to
pact_verifier, put it in the defaults and pass it through from
pact_verifier_cli, with a test that runs generate_request over the form
request from the issue.

Closes pact-foundation#588
…orm-urlencoded-generators

fix(pact_verifier): apply generators to form-urlencoded request bodies
…act_matching

chore(pact_matching): release v2.2.0
…act_models

chore(pact_models): release v1.3.18
…act_verifier

chore(pact_verifier): release v1.6.0
…_mock_server-v2.2.7

chore(deps): update pact_mock_server v2.2.7
…act_verifier_cli

chore(pact_verifier_cli): release v1.5.0
…ocker fetch stage (pact-foundation#608)

The fetch stage had no WORKDIR, so the tarball unpacked into / and
`install pact-verifier /pact-verifier` failed with "are the same file",
breaking the Docker image publish for v1.5.0.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Nothing exercised the XSLT step of the HTML report, so an xrust
upgrade could change its output unnoticed. The snapshot pins the
output of the default stylesheet for a failing result with a notice
and a passing interaction.

Assisted-by: Claude Code:claude-opus-5-5
xrust broke its API in two minor releases, and the old requirement
`xrust = "2.0.3"` admitted both:

- 2.3.0 gave `ParseError::MissingNameSpace` the fields `prefix`,
  `nsuri` and `message`.
- 2.4.0 renamed `StaticContextBuilder::fetcher` to `external`. The
  callback for external resources now takes `&External` and returns
  `Sequence<N>`, both in the builder and in `xslt::from_document`.

Any build that resolved dependencies afresh, such as `cargo install`
without `--locked` or a downstream lockfile update, picked up 2.4.1 and
failed to compile the report module. The requirement is now 2.4.1, the
first release with the current API.

The HTML report snapshot is unchanged under 2.4.1.

Assisted-by: Claude Code:claude-opus-5-5
pactffi_verifier_execute ran the whole verification on the calling
thread, which needs more stack than some callers have. Threads created
by Go or the JVM on musl (Alpine) get musl's 128 KiB default, which the
verification overflows, crashing the process with SIGSEGV.

Run the verification on a scoped thread with an 8 MiB stack and wait
for it, on every platform, falling back to the calling thread if the
thread cannot be started. The thread-local test run ID is carried over
so log callbacks keep working.
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.

3 participants