KEMBAR78
Improve logging when socket operations fail by OneBlue · Pull Request #13579 · microsoft/WSL · GitHub
Skip to content

Conversation

@OneBlue
Copy link
Collaborator

@OneBlue OneBlue commented Oct 8, 2025

Summary of the Pull Request

This will help diagnose issues like #13301

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

Copy link
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

This PR improves error logging for socket operations by adding source location information to help diagnose connection and socket-related issues. The changes add std::source_location parameters to socket operation functions to track where errors originate from.

Key Changes:

  • Added std::source_location parameters to socket operation functions for better error tracking
  • Created a custom formatter for std::source_location to enable logging
  • Updated error messages to include caller location information

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/windows/service/exe/WslCoreVm.h Added source_location parameter to AcceptConnection method signature
src/windows/service/exe/WslCoreVm.cpp Updated AcceptConnection implementation to pass location to socket operations
src/windows/common/socket.hpp Added source_location parameters to all socket operation function declarations
src/windows/common/socket.cpp Updated socket functions to accept and use location parameters for enhanced error logging
src/windows/common/hvsocket.hpp Added source_location parameters to Accept and Connect function declarations
src/windows/common/hvsocket.cpp Updated hvsocket functions to pass location information through socket operations
src/shared/inc/stringshared.h Added custom formatter for std::source_location and included source_location header
src/linux/init/util.h Added source_location parameter to UtilConnectVsock function declaration
src/linux/init/util.cpp Enhanced UtilConnectVsock error logging to include caller location information

@OneBlue OneBlue merged commit c7aad61 into master Oct 9, 2025
6 checks passed
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