solo-io / unik

The Unikernel & MicroVM Compilation and Deployment Platform
Apache License 2.0
2.72k stars 191 forks source link

Unik doesn't create firecracker socket and clean up leftover files #175

Open gcetusic opened 5 years ago

gcetusic commented 5 years ago

When trying to run firecracker this error occurs:

goc@gudmund:~/unik$ ./unik run --instanceName filter_instance --imageName filter
INFO[0000] running unik run                              env="map[]" host="localhost:3000" imageName=filter instanceName=filter_instance mounts="map[]"
ERRO[0000] failed running instance: [cmd/run.go:98] running image failed: %v: {[client/instances.go:103] failed with status 500: Put http://localhost/machine-config: dial unix /home/goc/.unik/firecracker/instances/filter_instance/firecracker.sock: connect: no such file or directory} 

After failing to run, it can't be retried because it doesn't clean up the files:

goc@gudmund:~/unik$ ./unik run --instanceName filter_instance --imageName filter
INFO[0000] running unik run                              env="map[]" host="localhost:3000" imageName=filter instanceName=filter_instance mounts="map[]"
ERRO[0000] failed running instance: [cmd/run.go:98] running image failed: %v: {[client/instances.go:103] failed with status 500: [firecracker/run_instance.go:52] can't create instance dir: {mkdir /home/goc/.unik/firecracker/instances/filter_instance: file exists}} 

Output of the daemon (with some prints added):

INFO[0001] Called startVMM(), setting up a VMM on /home/goc/.unik/firecracker/instances/lambda_go1/firecracker.sock INFO[0001] Terminal Program: xterm INFO[0001] Bin path: /home/goc/firecracker INFO[0001] firecracker exited: status=0 INFO[0001] returning from startVMM() time="2018-12-11T21:22:50+01:00" level=debug msg="Creating FIFO /home/goc/.unik/firecracker/instances/lambda_go1/logs.fifo" time="2018-12-11T21:22:50+01:00" level=debug msg="Creating FIFO /home/goc/.unik/firecracker/instances/lambda_go1/metrics.fifo" WARN[0001] setupLogging() returned Put http://localhost/logger: dial unix /home/goc/.unik/firecracker/instances/lambda_go1/firecracker.sock: connect: no such file or directory. Continuing anyway. ERRO[0001] PutMachineConfiguration returned [PUT /machine-config][204] putMachineConfigurationNoContent time="2018-12-11T21:22:50+01:00" level=debug msg="stopVMM(): sending sigterm to firecracker" time="2018-12-11T21:22:50+01:00" level=error msg="Firecracker Init returned error Put http://localhost/machine-config: dial unix /home/goc/.unik/firecracker/instances/lambda_go1/firecracker.sock: connect: no such file or directory" time="2018-12-11T21:22:50+01:00" level=error msg="error handling request" error="Put http://localhost/machine-config: dial unix /home/goc/.unik/firecracker/instances/lambda_go1/firecracker.sock: connect: no such file or directory" time="2018-12-11T21:22:50+01:00" level=debug msg="Completed 500 Internal Server Error in 69.066402ms\n"

My guess is that the problem is INFO[0001] firecracker exited: status=0 This exit handler function waits and the process it's waiting for (cmd.Start()) is finished too soon (removes the socket file)