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

Better logging for named pipe #11144

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

ryzngard
Copy link
Contributor

@ryzngard ryzngard commented Nov 3, 2024

Add logging on the server side for why a project isn't being serialized.

Reduce some of the logging on the client side if it gets into a bad state. Log once for first bad read and once when it gets to a point where we think we returned to a good state.

@ryzngard ryzngard requested a review from a team as a code owner November 3, 2024 23:18
Copy link
Contributor

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

I trust you that retrying makes sense, but it's not really clear to me why it wouldn't just immediately fail again :)

throw;
}

Logger.LogError("Failed to read ProjectInfoAction from stream");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this log the exception? I have no idea why this would fail, and need to be re-tried, but seems like the logs could help tell us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tbh it could be right now the only way it can throw is by getting an Assumes.Unreachable which isn't very actionable.

Copy link
Member

Choose a reason for hiding this comment

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

In a perfect world, Assumed.Unreachable should never be hit. It should just be used to make the compiler happy. If it's being hit, then expectations are incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with that for sure, but trying to figure out why the expectations are incorrect is currently the hard part.

@ryzngard
Copy link
Contributor Author

ryzngard commented Nov 4, 2024

I trust you that retrying makes sense, but it's not really clear to me why it wouldn't just immediately fail again :)

Because by reading data it moves the stream forward. That said I have a suspicion that it won't really recover but did some defensive programming around it. The updated server side is more important, but with VS Code this will flood logs pretty quickly if we don't stop. Maybe I should have just exited on fail... Or have some better retry logic to reconnect or something... but for now this is mostly to help figure out why Mac integration tests are failing in VS Code

@ryzngard ryzngard merged commit dab429d into dotnet:main Nov 5, 2024
12 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 5, 2024
@ryzngard ryzngard deleted the named_pipe_logging branch November 5, 2024 00:32
DustinCampbell added a commit that referenced this pull request Nov 5, 2024
This change is a follow-up to
#11144 (comment) that
addresses two issues that may help with diagnosis:

1. `Assumed.Unreachable(...)`captures the `[CallerFilePath]` and
`[CallerLineNumber]` but didn't do anything with them. Now, those values
are appended to the exception message.
2. Two `Assumed.Unreachable(...)` overloads have been added to allow a
custom exception message to be provided that can be used to add more
detail about a failure.
@jjonescz jjonescz modified the milestones: Next, 17.13 P2 Nov 25, 2024
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.

4 participants