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

Avoid constructing NetworkCredential objects on macOS machines #5058

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martin-toman
Copy link
Contributor

@martin-toman martin-toman commented Dec 5, 2024

Customers who use macOS agents behind an HTTP proxy suffer from malloc-related crashes described in dotnet/runtime#97966. The crash does not happen immediately, but after a few jobs are executed by the Agent.

When an HTTP proxy is configured, the Agent code creates NetworkCredential objects to pass basic auth creds.
From stack trace posted in the above issue, it sounds like the crash happens when internal .NET networking objects are being released/disposed. That could explain why customers are able to execute a few jobs ok - the crash happens when GC kicks in.

@martin-toman martin-toman requested review from a team as code owners December 5, 2024 08:15
@martin-toman martin-toman changed the title Avoid NetworkCredential objects on macOS Avoid constructing/disposing NetworkCredential objects on macOS Dec 5, 2024
@martin-toman martin-toman changed the title Avoid constructing/disposing NetworkCredential objects on macOS Avoid constructing/disposing NetworkCredential objects on macOS machines Dec 5, 2024
@martin-toman martin-toman changed the title Avoid constructing/disposing NetworkCredential objects on macOS machines Avoid constructing NetworkCredential objects on macOS machines Dec 5, 2024
@martin-toman martin-toman marked this pull request as draft December 5, 2024 08:24
ClientCertificatePassword = cerdStore.Read($"VSTS_AGENT_CLIENT_CERT_PASSWORD_{certSetting.ClientCertPasswordLookupKey}").Password;
var avoidNetCredentialFF = AgentKnobs.AvoidNetCredentialObjectsOnMac.GetValue(HostContext).AsBoolean();
var target = $"VSTS_AGENT_CLIENT_CERT_PASSWORD_{certSetting.ClientCertPasswordLookupKey}";
ClientCertificatePassword = avoidNetCredentialFF ? cerdStore.Read2(target).Password : cerdStore.Read(target).Password;

Choose a reason for hiding this comment

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

I think FF check can be removed here and directly Read2 can be used?

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