@@ -274,22 +274,24 @@ func (s *service) startEventForwarders(remotePublisher shim.Publisher) {
274274 go func () {
275275 <- s .vmReady
276276
277- if ! s .snapLoaded {
278- // Once the VM is ready, also start forwarding events from it to our exchange
279- attachCh := eventbridge . Attach ( ctx , s . eventBridgeClient , s . eventExchange )
277+ if s .snapLoaded {
278+ return
279+ }
280280
281- err := <- attachCh
282- if err != nil && err != context .Canceled && ! strings .Contains (err .Error (), "context canceled" ) {
283- s .logger .WithError (err ).Error ("error while forwarding events from VM agent" )
284- }
281+ // Once the VM is ready, also start forwarding events from it to our exchange
282+ attachCh := eventbridge .Attach (ctx , s .eventBridgeClient , s .eventExchange )
285283
286- err = <- republishCh
287- if err != nil && err != context .Canceled {
288- s .logger .WithError (err ).Error ("error while republishing events" )
289- }
284+ err : = <- attachCh
285+ if err != nil && err != context .Canceled && ! strings . Contains ( err . Error (), "context canceled" ) {
286+ s .logger .WithError (err ).Error ("error while forwarding events from VM agent " )
287+ }
290288
291- remotePublisher .Close ()
289+ err = <- republishCh
290+ if err != nil && err != context .Canceled {
291+ s .logger .WithError (err ).Error ("error while republishing events" )
292292 }
293+
294+ remotePublisher .Close ()
293295 }()
294296}
295297
@@ -736,7 +738,7 @@ func (s *service) StopVM(requestCtx context.Context, request *proto.StopVMReques
736738
737739// shutdownSnapLoadedVm shuts down a vm that has been loaded from a snapshot
738740func (s * service ) shutdownSnapLoadedVm () error {
739- // Kill firecracker process and its shild processes
741+ // Kill firecracker process and its child processes
740742 if err := syscall .Kill (- s .firecrackerPid , 9 ); err != nil {
741743 s .logger .WithError (err ).Error ("Failed to kill firecracker process" )
742744 return err
@@ -1799,9 +1801,9 @@ func (s *service) monitorVMExit() {
17991801
18001802func (s * service ) createHTTPControlClient () {
18011803 u := & httpunix.Transport {
1802- DialTimeout : 1000 * time .Millisecond ,
1803- RequestTimeout : 60 * time .Second ,
1804- ResponseHeaderTimeout : 60 * time .Second ,
1804+ DialTimeout : 500 * time .Millisecond ,
1805+ RequestTimeout : 15 * time .Second ,
1806+ ResponseHeaderTimeout : 15 * time .Second ,
18051807 }
18061808 u .RegisterLocation ("firecracker" , s .shimDir .FirecrackerSockPath ())
18071809
@@ -2178,7 +2180,7 @@ func (s *service) SendCreateSnapRequest(createSnapReq *http.Request) error {
21782180}
21792181
21802182// Offload Shuts down a VM and deletes the corresponding firecracker socket
2181- // and vsock. All of the other resources will persist. Depracated !
2183+ // and vsock. All of the other resources will persist. DEPRECATED !
21822184func (s * service ) Offload (ctx context.Context , req * proto.OffloadRequest ) (* empty.Empty , error ) {
21832185
21842186 if ! s .snapLoaded {
0 commit comments