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

Properly handle when git encounters an unrecoverable error #9423

Merged
merged 5 commits into from
Nov 26, 2024

Conversation

scbedd
Copy link
Member

@scbedd scbedd commented Nov 22, 2024

Don't infinitely loop. Resolves #9208

@scbedd scbedd self-assigned this Nov 22, 2024
@scbedd
Copy link
Member Author

scbedd commented Nov 22, 2024

/azp run tools - test-proxy - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd
Copy link
Member Author

scbedd commented Nov 23, 2024

/azp run tools - test-proxy - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd
Copy link
Member Author

scbedd commented Nov 23, 2024

/azp run tools - test-proxy - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd
Copy link
Member Author

scbedd commented Nov 25, 2024

As much as I hate to admit it, I don't think this is the right solution. The Environment.Exit is wrong. The source of the unhandled exception is because we're running in two different "modes" in the proxy.

  1. On CLI invocation of restore or push, we want to report a git error to CLI, then early exit from whatever command we're invoking.
  2. When the proxy is running in a server, we want to throw a GitProcessException (which is an HttpException) because our custom ASP.NET middleware will turn that unhandled exception into a clean HTTP response for the user.

Effectively, my solution will cause the server to straight crash if anything goes wrong with any "unhandled" git exception. I'm going to refactor so we can know what mode we're in via function signature update.

@scbedd
Copy link
Member Author

scbedd commented Nov 26, 2024

As much as I hate to admit it, I don't think this is the right solution. The Environment.Exit is wrong. The source of the unhandled exception is because we're running in two different "modes" in the proxy.

  1. On CLI invocation of restore or push, we want to report a git error to CLI, then early exit from whatever command we're invoking.
  2. When the proxy is running in a server, we want to throw a GitProcessException (which is an HttpException) because our custom ASP.NET middleware will turn that unhandled exception into a clean HTTP response for the user.

Effectively, my solution will cause the server to straight crash if anything goes wrong with any "unhandled" git exception. I'm going to refactor so we can know what mode we're in via function signature update.

Added a bit for this exact binary setting to GitProcessHandler, and honor it. That addresses the above without entirely rewriting every usage of GitHandler.Run. Thanks for the suggestion @benbp

@scbedd
Copy link
Member Author

scbedd commented Nov 26, 2024

/azp run tools - test-proxy - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd
Copy link
Member Author

scbedd commented Nov 26, 2024

/azp run tools - test-proxy - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd scbedd merged commit 4cc986a into main Nov 26, 2024
29 checks passed
@scbedd scbedd deleted the fix-infinite-retry branch November 26, 2024 23:16
@scbedd scbedd mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Address infinite loop in gitprocessexception while invoking push
2 participants