KEMBAR78
Ensure that socket timeouts are set only during the token validation by TravisEz13 · Pull Request #26066 · PowerShell/PowerShell · GitHub
Skip to content

Conversation

@TravisEz13
Copy link
Member

@TravisEz13 TravisEz13 commented Sep 17, 2025

PR Summary

This pull request refactors how socket timeouts are managed during token validation in RemoteSessionHyperVSocket.cs. The main goal is to ensure that socket timeouts are set only during the token validation phase and are properly reset afterward, improving reliability and preventing unintended blocking or premature timeouts in subsequent operations.

Socket Timeout Management Improvements:

  • Moved the setting of socket receive and send timeouts from the RemoteSessionHyperVSocketServer constructor to the ValidateToken method, ensuring timeouts are applied only during token validation. [1] [2]
  • Reset the socket receive and send timeouts to zero (disabling them) immediately after successful token validation, preventing timeouts from affecting later socket operations.

PR Context

This theoretical regression in #26057
This is theoretical because this code is not currently exercised.

PR Checklist

@TravisEz13 TravisEz13 changed the title Remove socket timeout configuration Ensure that socket timeouts are set only during the token validation Sep 18, 2025
@TravisEz13 TravisEz13 added CL-Engine Indicates that a PR should be marked as an engine change in the Change Log 7.5-regression The issue is a regression 7.4-regression Regression in 7.4 labels Sep 18, 2025
}

// Acknowledge the token is valid with "PASS".
socket.Send("PASS"u8);
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on behalf colleague, Can the timeout be triggered accidentally here?

@TravisEz13
Copy link
Member Author

/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM!

@daxian-dbw
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@daxian-dbw daxian-dbw merged commit 2376e28 into master Sep 22, 2025
36 of 39 checks passed
@daxian-dbw daxian-dbw deleted the TravisEz13-patch-4 branch September 22, 2025 17:56
@microsoft-github-policy-service
Copy link
Contributor

microsoft-github-policy-service bot commented Sep 22, 2025

📣 Hey @@TravisEz13, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

pwshBot pushed a commit to pwshBot/PowerShell that referenced this pull request Sep 22, 2025
…owerShell#26066)

The main goal is to ensure that socket timeouts are set only during the token validation phase and are properly reset afterward, improving reliability and preventing unintended blocking or premature timeouts in subsequent operations.
pwshBot pushed a commit to pwshBot/PowerShell that referenced this pull request Sep 22, 2025
…owerShell#26066)

The main goal is to ensure that socket timeouts are set only during the token validation phase and are properly reset afterward, improving reliability and preventing unintended blocking or premature timeouts in subsequent operations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.4-regression Regression in 7.4 7.5-regression The issue is a regression Backport-7.4.x-Migrated Backport-7.5.x-Migrated CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants