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

crc getting stuck on API #4518

Closed
albfan opened this issue Dec 17, 2024 · 2 comments · Fixed by #4519
Closed

crc getting stuck on API #4518

albfan opened this issue Dec 17, 2024 · 2 comments · Fixed by #4519
Assignees
Labels
kind/bug Something isn't working

Comments

@albfan
Copy link
Contributor

albfan commented Dec 17, 2024

General information

Cannot provide exact steps to reproduce, but sometimes crc gets stuck asking for version or status:

  • crc version
  • crc status

Patching crc during this episodes, looks its related with crc waiting forever for an API reply.

Operating System

Linux

Hypervisor

KVM

Did you run crc setup before crc start?

yes

Running on

Laptop

Steps to reproduce

  1. crc status
  2. command never finished

CRC version

CRC version: 2.45.0+7aeb3b
OpenShift version: 4.17.7
MicroShift version: 4.17.7

CRC status

CRC VM:          Running
OpenShift:       Running (v4.17.7)
RAM Usage:       32.87GB of 42.34GB
Disk Usage:      7.071GB of 10.95GB (Inside the CRC VM)
Cache Usage:     25.71GB
Cache Directory: /home/alberto/.crc/cache

CRC config

Properties: 

* bundle                                     Bundle path/URI - absolute or local path, http, https or docker URI (string, like 'https://foo.com/crc_libvirt_4.17.7_amd64.crcbundle', 'docker://quay.io/myorg/crc_libvirt_4.17.7_amd64.crcbundle:2.45.0' default '/home/alberto/.crc/cache/crc_libvirt_4.17.7_amd64.crcbundle' )
* consent-telemetry                          Consent to collection of anonymous usage data (yes/no)
* cpus                                       Number of CPU cores (must be greater than or equal to '4')
* disable-update-check                       Disable update check (true/false, default: false)
* disk-size                                  Total size in GiB of the disk (must be greater than or equal to '31')
* enable-bundle-quay-fallback                If bundle download from the default location fails, fallback to quay.io (true/false, default: false)
* enable-cluster-monitoring                  Enable cluster monitoring Operator (true/false, default: false)
* enable-emergency-login                     Enable emergency login for 'core' user. Password is randomly generated. (true/false, default: false)
* enable-experimental-features               Enable experimental features (true/false, default: false)
* enable-shared-dirs                         Mounts host's home directory at '/' in the CRC VM (true/false, default: true)
* host-network-access                        Allow TCP/IP connections from the CRC VM to services running on the host (true/false, default: false)
* http-proxy                                 HTTP proxy URL (string, like 'http://my-proxy.com:8443')
* https-proxy                                HTTPS proxy URL (string, like 'https://my-proxy.com:8443')
* ingress-http-port                          HTTP port to use for OpenShift ingress/routes on the host (1024-65535, default: 80)
* ingress-https-port                         HTTPS port to use for OpenShift ingress/routes on the host (1024-65535, default: 443)
* kubeadmin-password                         User defined kubeadmin password
* memory                                     Memory size in MiB (must be greater than or equal to '10752')
* nameserver                                 IPv4 address of nameserver (string, like '1.1.1.1 or 8.8.8.8')
* network-mode                               Network mode (user or system)
* no-proxy                                   Hosts, ipv4 addresses or CIDR which do not use a proxy (string, comma-separated list such as '127.0.0.1,192.168.100.1/24')
* persistent-volume-size                     Total size in GiB of the persistent volume used by the CSI driver for microshift preset (must be greater than or equal to '15')
* preset                                     Virtual machine preset (valid values are: [okd microshift openshift])
* proxy-ca-file                              Path to an HTTPS proxy certificate authority (CA)
* pull-secret-file                           Path of image pull secret (download from https://console.redhat.com/openshift/create/local)
* skip-check-admin-helper-cached             Skip preflight check (true/false, default: false)
* skip-check-bundle-extracted                Skip preflight check (true/false, default: false)
* skip-check-crc-network                     Skip preflight check (true/false, default: false)
* skip-check-crc-network-active              Skip preflight check (true/false, default: false)
* skip-check-crc-symlink                     Skip preflight check (true/false, default: false)
* skip-check-daemon-systemd-sockets          Skip preflight check (true/false, default: false)
* skip-check-daemon-systemd-unit             Skip preflight check (true/false, default: false)
* skip-check-dnsmasq-network-manager-config  Skip preflight check (true/false, default: false)
* skip-check-kvm-enabled                     Skip preflight check (true/false, default: false)
* skip-check-libvirt-driver                  Skip preflight check (true/false, default: false)
* skip-check-libvirt-group-active            Skip preflight check (true/false, default: false)
* skip-check-libvirt-installed               Skip preflight check (true/false, default: false)
* skip-check-libvirt-running                 Skip preflight check (true/false, default: false)
* skip-check-libvirt-version                 Skip preflight check (true/false, default: false)
* skip-check-network-manager-dispatcher-file Skip preflight check (true/false, default: false)
* skip-check-network-manager-installed       Skip preflight check (true/false, default: false)
* skip-check-network-manager-running         Skip preflight check (true/false, default: false)
* skip-check-podman-in-ocbindir              Skip preflight check (true/false, default: false)
* skip-check-ram                             Skip preflight check (true/false, default: false)
* skip-check-root-user                       Skip preflight check (true/false, default: false)
* skip-check-supported-cpu-arch              Skip preflight check (true/false, default: false)
* skip-check-systemd-networkd-running        Skip preflight check (true/false, default: false)
* skip-check-systemd-resolved-running        Skip preflight check (true/false, default: false)
* skip-check-user-in-libvirt-group           Skip preflight check (true/false, default: false)
* skip-check-virt-enabled                    Skip preflight check (true/false, default: false)
* skip-check-vsock                           Skip preflight check (true/false, default: false)
* skip-check-wsl2                            Skip preflight check (true/false, default: false)

Usage:
  crc config SUBCOMMAND [flags]
  crc config [command]

Available Commands:
  get         Get a crc configuration property
  set         Set a crc configuration property
  unset       Unset a crc configuration property
  view        Display all assigned crc configuration properties

Flags:
  -h, --help   help for config

Global Flags:
      --log-level string   log level (e.g. "debug | info | warn | error") (default "info")

Use "crc config [command] --help" for more information about a command.

Host Operating System

NAME="Fedora Linux"
VERSION="41 (Workstation Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=41
VERSION_CODENAME=""
PLATFORM_ID="platform:f41"
PRETTY_NAME="Fedora Linux 41 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:41"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=41
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=41
SUPPORT_END=2025-12-15
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Expected behavior

crc to give up at some moment with a correct or incorrect reply (with proper exit status)

Actual behavior

crc hangs forever

CRC Logs

Additional context

No response

@albfan albfan added the kind/bug Something isn't working label Dec 17, 2024
@albfan
Copy link
Contributor Author

albfan commented Dec 17, 2024

From:

https://medium.com/@nate510/don-t-use-go-s-default-http-client-4804cb19f779

--- i/pkg/crc/daemonclient/client.go
+++ w/pkg/crc/daemonclient/client.go
@@ -3,6 +3,7 @@ package daemonclient
 import (
        "fmt"
        "net/http"
+       "time"
 
        networkclient "github.com/containers/gvisor-tap-vsock/pkg/client"
        "github.com/crc-org/crc/v2/pkg/crc/api/client"
@@ -24,6 +25,7 @@ func New() *Client {
                        Transport: transport(),
                }, "http://unix/network"),
                APIClient: client.New(&http.Client{
+                       Timeout: 30 * time.Second,
                        Transport: transport(),
                }, "http://unix/api"),
                SSEClient: client.NewSSEClient(transport()),

Ths set a default timeout of 30s. If we have other timeouts we might use same here, or provide a way to config this timeout

@anjannath
Copy link
Member

I think a timeout 30sec is plenty enough since this is happening locally over a unix socket, and also we don't need this timeout to be configurable as of now, please raise a PR with the changes you posted in #4518 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants