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

fix: add timeout checking docker socket #3279

Closed
wants to merge 1 commit into from
Closed

fix: add timeout checking docker socket #3279

wants to merge 1 commit into from

Conversation

deboer-tim
Copy link
Collaborator

@deboer-tim deboer-tim commented Jul 19, 2023

What does this PR do?

Narrowed issue #3272 down to a missing timeout in isDisguisedPodman(). It looks like the socket is there but never responds, which means that we never allow the Podman extension to start. From googling Node HTTP does not appear to have any default timeout (and if it does, I've waited minutes).

Added a 5s timeout. Maybe there is a better values, but this gives it a chance even on a slower machine, and the 5s delay for full startup isn't noticeable.

I presume we should put timeouts on most (all?) of our HTTP requests just in case we ever hit similar problems? I could take a pass via another PR.

Screenshot/screencast of this PR

N/A

What issues does this PR fix or reference?

Fixes #3272.

How to test this PR?

Confirm Podman extension starts up normally.

Narrowed issue #3272 down to a missing timeout in isDisguisedPodman(). It looks
like the socket is there but never responds, which means that we never allow
the Podman extension to start.

Signed-off-by: Tim deBoer <git@tdeboer.ca>
@deboer-tim deboer-tim requested review from a team and benoitf as code owners July 19, 2023 18:43
@deboer-tim deboer-tim requested review from jeffmaury and lstocchi and removed request for a team July 19, 2023 18:43
// do nothing
});
const req = http
.get(podmanPingUrl, res => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would probably use the timeout option of the get method
https://nodejs.org/api/http.html#httprequestoptions-callback

For example https://github.com/containers/podman-desktop/blob/main/packages/main/src/plugin/extensions-catalog/extensions-catalog.ts#L142-148

I would also file an issue about limiting the time the activate method of an extension can take
For example activation of an extension should not take more than 5s.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would probably use the timeout option of the get method https://nodejs.org/api/http.html#httprequestoptions-callback

For example https://github.com/containers/podman-desktop/blob/main/packages/main/src/plugin/extensions-catalog/extensions-catalog.ts#L142-148

I had tried adding timeout: 5000 in podmanPingUrl and listening for timeout events within the get() first, but I couldn't get it to actually timeout; adding the separate setTimeout() worked. When googling all the examples (even after the timeout property was 'recently' added) were doing the same thing.

Seems I'm not the only one - sporadic reports here, mostly for the timeout option: nodejs/node#23282

I would also file an issue about limiting the time the activate method of an extension can take For example activation of an extension should not take more than 5s.

#3280 opened.

@deboer-tim
Copy link
Collaborator Author

General issue split off to #3280.

Copy link
Contributor

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

I was able to test it correctly and it came up totally fine.

I guess we could move forward with this PR and fix the issue in a later PR? Since it's another issue.

Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

I need to investigate

@benoitf
Copy link
Collaborator

benoitf commented Aug 11, 2023

@deboer-tim as requested, I looked and I provided #3497 using the timeout option

@deboer-tim
Copy link
Collaborator Author

Closing in favour of #3497.

@deboer-tim deboer-tim closed this Aug 11, 2023
@deboer-tim deboer-tim deleted the timeout branch February 22, 2024 17:20
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.

Hang in podman extension checkDisguisedPodmanSocket() on startup
3 participants