Skip to content
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

fix: Resolve race condition in HTTP server handling #20

Closed
wants to merge 3 commits into from

Conversation

daveads
Copy link
Contributor

@daveads daveads commented Oct 2, 2024

fix: Resolve race condition in HTTP server handling

  • Implement thread-safe safeServer to wrap http.Server
  • Modify Serve function to use safeServer for improved concurrency
  • Ensure atomic operations for server start and shutdown

This change addresses a race condition in the HTTP server handling,particularly affecting CLI tests. By introducing a safeServer struct with atomic operations and proper synchronization, and prevent potential data races during server startup and shutdown.

Fix for terrastruct/d2#2087

@daveads
Copy link
Contributor Author

daveads commented Oct 2, 2024

@alixander change the current version of golang to fix the ci failing test

Use actions/setup-go@v4 instead of actions/setup-go@v3

@daveads
Copy link
Contributor Author

daveads commented Oct 2, 2024

@alixander should i just replace atomic.Bool with atomic.Int32 which is support by go v1.18

@daveads
Copy link
Contributor Author

daveads commented Oct 2, 2024

@alixander your attention is needed here.

@alixander
Copy link
Contributor

i've bumped the setup-go action in master, please rebase

@daveads
Copy link
Contributor Author

daveads commented Oct 2, 2024

@alixander ready for merge...

Copy link
Contributor

@alixander alixander left a comment

Choose a reason for hiding this comment

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

this is just another way of doing what you did in the last PR right? Can you revert the last PR's changes then

@daveads daveads closed this Oct 3, 2024
@daveads daveads deleted the race-fix branch October 3, 2024 11:17
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