Skip to content

adjust shutdown process on the httpserver to remove fsm noise #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025

Conversation

robbyt
Copy link
Owner

@robbyt robbyt commented May 29, 2025

Previously, the httpserver.Runner shutdown process had two concurrent paths that could trigger FSM state transitions: explicit Stop() calls and context cancellation. This could cause race conditions where both paths attempted to transition the FSM from Running to Stopping state simultaneously, resulting in "current state mismatch" warnings.

This fixes that problem by consolidating all FSM transitions into a single shutdown() method. The Stop() method now only cancels the context, while the Run() method detects cancellation and calls shutdown() to handle state transitions. This eliminates the race condition by ensuring only one code path manages FSM state changes during shutdown.

Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link

@robbyt robbyt merged commit 4dca16c into main May 29, 2025
5 checks passed
@robbyt robbyt deleted the rterhaar/fix-httpserver-shutdown branch May 29, 2025 22:31
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.

1 participant