Skip to content

Add missing synchronization around load WinHttp proxy methods - #41909

Open
Blue (OneBlue) wants to merge 2 commits into
masterfrom
user/oneblue/fix-race-9
Open

Blue (OneBlue) wants to merge 2 commits into
masterfrom
user/oneblue/fix-race-9

Conversation

@OneBlue

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

This change moves the entire loading of the winhttp methods under the std::call_once, otherwise two threads could be trying to load the methods in parallel and write the global std::optionals at the same time

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@OneBlue
Blue (OneBlue) requested a review from a team as a code owner October 13, 2026 19:26
Copilot AI balanced review requested due to automatic review settings October 13, 2026 19:26

Copilot AI 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.

🟡 Changes recommended

Failed function loads are incorrectly converted to success, leaving required optionals empty.

1 open finding
What changed in this PR

Moves WinHTTP API loading under one-time synchronization to prevent concurrent writes.

Changes:

  • Synchronizes module and function loading with std::call_once.
  • Caches the load result for subsequent callers.
File Description
src/​windows/​service/​exe/​LxssHttpProxy.cpp Makes WinHTTP proxy API initialization thread-safe.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/windows/service/exe/LxssHttpProxy.cpp Outdated
Copilot AI balanced review requested due to automatic review settings October 13, 2026 21:04

Copilot AI 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.

🟢 Approval recommended

The focused change correctly serializes initialization and safely publishes its result to concurrent callers.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

This branch has not been deployed

No deployments
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.

3 participants