Skip to content

Add internal endpoint for tokio task dumps - #5594

Merged
joshua-spacetime merged 4 commits into
masterfrom
joshua/tokio-taskdump
Jul 27, 2026
Merged

Add internal endpoint for tokio task dumps#5594
joshua-spacetime merged 4 commits into
masterfrom
joshua/tokio-taskdump

Conversation

@joshua-spacetime

@joshua-spacetime joshua-spacetime commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Introduces another /internal route for capturing tokio task dumps.

The endpoint is available under /internal/task-dump and returns a plain-text dump of every task on the selected Tokio runtime.

Usage Examples

Dump the main runtime

curl -fsS \
  'http://127.0.0.1:3000/internal/task-dump?runtime=main' \
  > task-dump-main.txt

timeout_ms defaults to 2 seconds.

Dump the replication runtime with a longer timeout

curl -fsS \
  'http://127.0.0.1:80/internal/task-dump?runtime=replication&timeout_ms=5000' \
  > task-dump-replication.txt

An unknown runtime returns 400 Bad Request with the valid names. If the runtime cannot complete the dump within the requested timeout, the endpoint returns 504 Gateway Timeout.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

  • Manual test on supported platform (not macos)

@joshua-spacetime
joshua-spacetime marked this pull request as ready for review July 27, 2026 18:14

@gefjon gefjon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works on my machine, except that:

  • No replication runtime on standalone.
  • Query param for timeout is timeout-ms, not timeout_ms, due to some rewriting somewhere between Axum and serde.
    • EDIT: I was misinterpreting the error from replication being an unknown runtime. timeout_ms does appear to be correct. timeout-ms is ignored as an unknown query param.

But I was able to run several requests and get sensible responses against SpacetimeDB-standalone running locally.

@joshua-spacetime
joshua-spacetime added this pull request to the merge queue Jul 27, 2026
Merged via the queue into master with commit 0935d32 Jul 27, 2026
43 checks passed
@joshua-spacetime
joshua-spacetime deleted the joshua/tokio-taskdump branch July 27, 2026 22:22
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