Skip to content

Fix : CLI hangs indefinitely during network failures due to missing http.Client timeouts - #547

Open
aniket866 wants to merge 9 commits into
microcks:masterfrom
aniket866:fix/http-client-timeOut
Open

aniket866 wants to merge 9 commits into
microcks:masterfrom
aniket866:fix/http-client-timeOut

Conversation

@aniket866

@aniket866 aniket866 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Before this fix: The command hung indefinitely in the terminal with no output until manually killed (Ctrl + C).

With this fix: It automatically stops after 30 seconds with an error.

image image

3rd image shows that it cancelled after 30 sec

AI disclosure: I have used Chatgpt to review related files and do changes in snippits.

Closes #545

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
@aniket866

Copy link
Copy Markdown
Contributor Author

@Vaishnav88sk
Please have a look

@aniket866 aniket866 changed the title Fix : Network requests cannot be gracefully cancelled via Ctrl+C (Missing context propagation) Fix : CLI hangs indefinitely during network failures due to missing http.Client timeouts Sep 27, 2026

@Vaishnav88sk Vaishnav88sk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread pkg/connectors/microcks_client_test.go Resolved
Comment thread CHANGELOG.md Resolved
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Comment thread pkg/connectors/keycloak_client.go Resolved
@yada

yada commented Oct 28, 2026

Copy link
Copy Markdown
Member

Verified the merge result (build, go vet, go test ./... pass). Against a server that never answers, import waits indefinitely on master (I stopped after 60s), and fails after 30s with exit 11 (Client.Timeout exceeded while awaiting headers) with this PR, which is what #545 asks for.

One concern before merge: the 30s http.Client.Timeout covers the whole exchange, including the body transfer. A large artifact upload or download on a slow link, or a slow Microcks response, would now fail after 30s, and there is no flag to change it. Could you either use a dial and response-header timeout (net.Dialer.Timeout, ResponseHeaderTimeout) instead of a global Timeout, or make the value configurable?

Disclosure: this comment was drafted with AI assistance, and the results were run locally.

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
@aniket866
aniket866 requested a review from Caesarsage as a code owner October 31, 2026 18:50
@aniket866

Copy link
Copy Markdown
Contributor Author

@Caesarsage @yada
I have done the requested changes , this PR is now ready to be reviewed/merged.

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
@Caesarsage

Copy link
Copy Markdown
Collaborator

Thanks @aniket866, the dial and response-header timeouts look right. Once master's policy-guards is fixed, could you drop the cmd/login_test.go change so this is only about timeouts?

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
@aniket866

Copy link
Copy Markdown
Contributor Author

@Caesarsage
This PR is also ready, Please have a look

This branch was successfully deployed

1 active deployment
Build — 41659a9c Deployed Nov 28, 2026 by aniket866 via build-verify-package #920
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/connectors kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: CLI hangs indefinitely during network failures due to missing http.Client timeouts

5 participants