Skip to content

fix: ignore grpc.ErrServerStopped in MockServer serve goroutine to st…#1701

Merged
gsstoykov merged 3 commits into
mainfrom
fix/mock-server-panic-bug
May 15, 2026
Merged

fix: ignore grpc.ErrServerStopped in MockServer serve goroutine to st…#1701
gsstoykov merged 3 commits into
mainfrom
fix/mock-server-panic-bug

Conversation

@Dosik13

@Dosik13 Dosik13 commented May 11, 2026

Copy link
Copy Markdown
Contributor

Description:

Fix intermittent unit-test CI panic panic: grpc: the server has been stopped originating from the MockServer serve goroutine in sdk/mock_test.go. The goroutine was panicking on any non-nil error from grpc.Server.Serve, including the expected grpc.ErrServerStopped sentinel returned after a normal GracefulStop. Under -race and CI load, the serve goroutine can be scheduled after MockServer.Close has already called GracefulStop, at which point Serve returns ErrServerStopped and the whole test binary aborts.

  • Filter grpc.ErrServerStopped from the panic in NewMockServer's serve goroutine.
  • Use a local err inside the goroutine instead of closing over the outer err declared in NewMockServer.
  • Add errors to the imports in sdk/mock_test.go.

Related issue(s):

Fixes #1700

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

…op CI flake

Signed-off-by: dosi <dosi.kolev@limechain.tech>
@Dosik13 Dosik13 requested review from a team as code owners May 11, 2026 14:06
@Dosik13 Dosik13 requested a review from agadzhalov May 11, 2026 14:06
@lfdt-bot

lfdt-bot commented May 11, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production

codacy-production Bot commented May 11, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dosik13 Dosik13 moved this to 📋 Backlog in Hiero SDK Sprint Board May 13, 2026
@Dosik13 Dosik13 moved this from 📋 Backlog to 👀 In Review in Hiero SDK Sprint Board May 14, 2026
@gsstoykov gsstoykov merged commit 5c42fcf into main May 15, 2026
17 checks passed
@gsstoykov gsstoykov deleted the fix/mock-server-panic-bug branch May 15, 2026 12:24
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.

Flaky unit-test CI: panic "grpc: the server has been stopped" in MockServer goroutine

3 participants