Skip to content

Add goroutine leak detection tests to Relayer, TXM, and LogPoller services#734

Draft
ogtownsend wants to merge 12 commits into
mainfrom
ogt/add-leak-detection-test-to-services
Draft

Add goroutine leak detection tests to Relayer, TXM, and LogPoller services#734
ogtownsend wants to merge 12 commits into
mainfrom
ogt/add-leak-detection-test-to-services

Conversation

@ogtownsend
Copy link
Copy Markdown
Collaborator

    logger.go:146: 17:45:16.550756000	DEBUG	Txm	confirmLoop: stopped	{"version": "(devel)@unset"}
    leak.go:23: found unexpected goroutines:
        [Goroutine 61 in state select (no cases), with github.com/smartcontractkit/chainlink-ton/pkg/txm.(*Txm).Start.func1.1 on top of the stack:
        github.com/smartcontractkit/chainlink-ton/pkg/txm.(*Txm).Start.func1.1()
        	/.../chainlink-ton/pkg/txm/txm.go:127 +0x1c
        created by github.com/smartcontractkit/chainlink-ton/pkg/txm.(*Txm).Start.func1 in goroutine 57
        	/.../chainlink-ton/pkg/txm/txm.go:127 +0xfc
        ]
--- FAIL: TestTxmLeak (0.75s)

@ogtownsend ogtownsend requested a review from a team as a code owner May 8, 2026 00:49
Copilot AI review requested due to automatic review settings May 8, 2026 00:49
@ogtownsend ogtownsend marked this pull request as draft May 8, 2026 00:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

👋 ogtownsend, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copy link
Copy Markdown
Contributor

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 goroutine leak-detection coverage for TON core services by running real Start/Close paths under goleak, exercising key public APIs to ensure background loops and tickers shut down cleanly.

Changes:

  • Add leak tests for txm, logpoller, and a relay “bundle” (txm + logpoller + balance monitor) using servicetest.RunHealthy() and tests.VerifyNoLeaks().
  • Minor error formatting change in relay service (%q%v) for transaction status.
  • Update module/toolchain and dependencies (Go version, chainlink-common, go-plugin, and related indirect deps), plus .cursor/ added to .gitignore.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/txm/leak_test.go New goleak-backed test that starts Txm, exercises Enqueue, and verifies clean shutdown.
pkg/logpoller/leak_test.go New goleak-backed test that starts LogPoller, exercises filter ops + replay, and verifies clean shutdown.
pkg/relay/leak_test.go New leak test that starts Txm + LogPoller + balance monitor together to mirror chain wiring.
pkg/relay/service.go Adjust error formatting for unexpected transaction status.
go.mod Bumps Go version and updates dependencies (incl. adding goleak indirect).
go.sum Dependency checksum updates from the module changes.
.gitignore Ignores .cursor/ directory.

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

Comment thread go.mod
Comment thread go.mod Outdated
Comment thread pkg/logpoller/leak_test.go
Comment thread pkg/txm/leak_test.go Outdated
rv := reflect.ValueOf(data)
rt := rv.Type()
if rt.Kind() == reflect.Ptr {
if rt.Kind() == reflect.Pointer {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

lints

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