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

[BUG] Daemon not properly initialized after crc setup #2687

Closed
adrianriobo opened this issue Sep 1, 2021 · 9 comments
Closed

[BUG] Daemon not properly initialized after crc setup #2687

adrianriobo opened this issue Sep 1, 2021 · 9 comments
Labels
kind/bug Something isn't working os/macos

Comments

@adrianriobo
Copy link
Contributor

The daemon process on macos is started from the tray process. The tray is installed before extracting and uncompressing the bundle, so when this long process happens during the setup the daemon is properly initialized.

When we start crc on a previous environment, and all the commands are included on a script (no delay between setup without require bundle management) the setup ends up successfully but the daemon is not properly initialized, and the start ends up failing.

In this case the setup probably should check the state of the daemon to ack that your system is ready to start crc.

Notice that in this case skipping the update check on the start will produce the error, with the check in place the delay is enough for the daemon.

To reproduce:

  1. Create a pre existing environment

  2. Create a script

crc cleanup
crc setup
CRC_DISABLE_UPDATE_CHECK=true crc start -p PULL_SECRET  --log-level debug
  1. Run the script

Logs from previous script

INFO Unload CodeReady Containers tray             
INFO Removing launchd configuration for tray      
INFO Removing /etc/resolver/testing file          
INFO Unload CodeReady Containers daemon           
INFO Stopping CRC Hyperkit process                
INFO Removing hosts file records added by CRC     
INFO Removing pull secret from the keyring        
INFO Removing older logs                          
INFO Removing CRC Machine Instance directory      
Cleanup finished
INFO Checking if running as non-root              
INFO Checking if crc-admin-helper executable is cached 
INFO Checking for obsolete admin-helper executable 
INFO Checking if running on a supported CPU architecture 
INFO Checking minimum RAM requirements            
INFO Checking if running emulated on a M1 CPU     
INFO Checking if HyperKit is installed            
INFO Checking if qcow-tool is installed           
INFO Checking if crc-driver-hyperkit is installed 
INFO Checking if CodeReady Containers daemon is running 
INFO Checking if launchd configuration for tray exists 
INFO Creating launchd configuration for tray      
INFO Check if CodeReady Containers tray is running 
INFO Checking if CRC bundle is extracted in '$HOME/.crc' 
INFO Checking if /Applications/CodeReady Containers.app/Contents/Resources/crc_hyperkit_4.8.4.crcbundle exists 
Your system is correctly setup for using CodeReady Containers, you can now run 'crc start' to start the OpenShift cluster
DEBU CodeReady Containers version: 1.31.2+19538dab 
DEBU OpenShift version: 4.8.4 (not embedded in executable) 
DEBU Running 'crc start'                          
DEBU Total memory of system is 34359738368 bytes  
Is '/Applications/CodeReady Containers.app' running? Cannot reach daemon API: Get "http://unix/api/version": dial unix /Users/crcqe/.crc/crc-http.sock: connect: connection refused
@praveenkumar
Copy link
Member

@adrianriobo does it eventually come up or never come up?

@adrianriobo
Copy link
Contributor Author

adrianriobo commented Sep 2, 2021

@praveenkumar come up? what do you mean? crc start exit on error...then if you start again it works, even if you do it manually it work.... as long as you somehow introduce a bit delay to allow daemon to be ready it will work

@guillaumerose
Copy link
Contributor

Should we add a polling loop in crc setup or should this be only in tests?

@adrianriobo
Copy link
Contributor Author

adrianriobo commented Sep 2, 2021

crc setup does not warrant the valid state of the daemon... , I hit this on tests but you can mimic with a sample bash script to automate crc setup and crc start which I guess it could be a common use case

@praveenkumar
Copy link
Member

As you said in the issue if you have CRC_DISABLE_UPDATE_CHECK to false which default is then it provide enough time for daemon to run so even user do scripting they are not hit this issue until they also disable the update check. Otherwise during the setup we have to make sure if daemon is running by polling it and wait util it is up.

@adrianriobo
Copy link
Contributor Author

adrianriobo commented Sep 6, 2021

make sure if daemon is running by polling it and wait util it is up

Setup claims your system is ready to start crc which is not true as you are not ensuring this condition?

anjannath added a commit to anjannath/crc that referenced this issue Sep 13, 2021
…unning

the daemon might take a few seconds to come up and make the api endpoint available
it is better to check that the daemon is up by trying to access this endpoint   to
make sure user is successfully able to do `crc start` after `crc setup`
anjannath added a commit to anjannath/crc that referenced this issue Sep 14, 2021
…unning

the daemon might take a few seconds to come up and make the api endpoint available
it is better to check that the daemon is up by trying to access this endpoint   to
make sure user is successfully able to do `crc start` after `crc setup`
anjannath added a commit to anjannath/crc that referenced this issue Sep 14, 2021
…unning

the daemon might take a few seconds to come up and make the api endpoint available
it is better to check that the daemon is up by trying to access this endpoint   to
make sure user is successfully able to do `crc start` after `crc setup`
praveenkumar pushed a commit that referenced this issue Sep 15, 2021
the daemon might take a few seconds to come up and make the api endpoint available
it is better to check that the daemon is up by trying to access this endpoint   to
make sure user is successfully able to do `crc start` after `crc setup`
@adrianriobo
Copy link
Contributor Author

Fixed by #2722

@adrianriobo
Copy link
Contributor Author

/close

@openshift-ci openshift-ci bot closed this as completed Sep 28, 2021
@openshift-ci
Copy link

openshift-ci bot commented Sep 28, 2021

@adrianriobo: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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 os/macos
Projects
None yet
Development

No branches or pull requests

4 participants