Skip to content

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

@azure-pipelines
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

@azure-pipelines
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

@azure-pipelines
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

@azure-pipelines
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

@azure-pipelines
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

Development

Successfully merging this pull request may close these issues.

Address infinite loop in gitprocessexception while invoking push

3 participants