Skip to content

Print threads backtrace on SIGINFO/SIGPWR#1830

Open
sobrinho wants to merge 8 commits intocucumber:mainfrom
sobrinho:main
Open

Print threads backtrace on SIGINFO/SIGPWR#1830
sobrinho wants to merge 8 commits intocucumber:mainfrom
sobrinho:main

Conversation

@sobrinho
Copy link
Copy Markdown

@sobrinho sobrinho commented Mar 13, 2026

Description

Debugging stuck builds is always tricky and this will add a thread backtrace dump to STDERR when the process is signaled with SIGINFO (macOS) or SIGPWR (linux).

On macOS you can use CTRL+T to signal the running process. Linux you can use kill -PWR pid.

I have a PR open against RSpec as well here.

This is a common pattern used by Sidekiq and Puma that I'm aware of but possibly other projects as well.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds new behaviour)

Please add an entry to the relevant section of CHANGELOG.md as part of this pull request.

Checklist:

Your PR is ready for review once the following checklist is
complete. You can also add some checks if you want to.

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

@luke-hill
Copy link
Copy Markdown
Contributor

Ignore any failing tests in CI for the CCK

@luke-hill
Copy link
Copy Markdown
Contributor

This has CI failures related to this code. I'm currently knee-deep in investigating / fixing up other areas of the main codebase so won't be able to dive into this much in the next 1-2 weeks

@sobrinho
Copy link
Copy Markdown
Author

@luke-hill fixed

@sobrinho
Copy link
Copy Markdown
Author

Failures are not related to this PR.

@sobrinho
Copy link
Copy Markdown
Author

@luke-hill would you fire the workflows again? Updated with main.

@luke-hill
Copy link
Copy Markdown
Contributor

The failures are on main, so for now I just want to focus on getting main fixed up. I know what final bits need fixing. So for now this looks good.

Just give me a small amount of time to get back to you on this.

@luke-hill
Copy link
Copy Markdown
Contributor

Hi @sobrinho

All of the existing issues I needed to fix are now done. I've asked copilot to give this a quick review.
Can you rebase / merge with main at which point CI should be fully green.

Once that's all done I'll give it one last review and endeavour to merge this and release v11

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a signal handler to the Cucumber CLI to dump all threads’ backtraces to the error stream when receiving SIGINFO (macOS) or SIGPWR (Linux), to help debug stuck builds.

Changes:

  • Register a SIGINFO/SIGPWR trap during Cucumber::Cli::Main#execute! to print a per-thread backtrace dump to @err.
  • Add a CLI spec that triggers the signal and asserts a backtrace line is emitted.
  • Document the new behavior in CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lib/cucumber/cli/main.rb Adds trap_thread_dump_signal and hooks it into execute! to print thread backtraces on SIGINFO/SIGPWR.
spec/cucumber/cli/main_spec.rb Adds a spec that sends SIGINFO/SIGPWR to self and verifies a backtrace dump is written to stderr.
CHANGELOG.md Adds an “Unreleased” changelog entry for the new thread-dump-on-signal behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@luke-hill
Copy link
Copy Markdown
Contributor

@sobrinho if you're able to get this fixed up reviews wise and CI wise in the next few days I can commit to merge this and deploying this into v11. WDYT?

@sobrinho
Copy link
Copy Markdown
Author

@luke-hill fixed!

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