@@ -274,22 +274,24 @@ func (s *service) startEventForwarders(remotePublisher shim.Publisher) {
274
274
go func () {
275
275
<- s .vmReady
276
276
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
+ }
280
280
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 )
285
283
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
+ }
290
288
291
- remotePublisher .Close ()
289
+ err = <- republishCh
290
+ if err != nil && err != context .Canceled {
291
+ s .logger .WithError (err ).Error ("error while republishing events" )
292
292
}
293
+
294
+ remotePublisher .Close ()
293
295
}()
294
296
}
295
297
@@ -736,7 +738,7 @@ func (s *service) StopVM(requestCtx context.Context, request *proto.StopVMReques
736
738
737
739
// shutdownSnapLoadedVm shuts down a vm that has been loaded from a snapshot
738
740
func (s * service ) shutdownSnapLoadedVm () error {
739
- // Kill firecracker process and its shild processes
741
+ // Kill firecracker process and its child processes
740
742
if err := syscall .Kill (- s .firecrackerPid , 9 ); err != nil {
741
743
s .logger .WithError (err ).Error ("Failed to kill firecracker process" )
742
744
return err
@@ -1799,9 +1801,9 @@ func (s *service) monitorVMExit() {
1799
1801
1800
1802
func (s * service ) createHTTPControlClient () {
1801
1803
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 ,
1805
1807
}
1806
1808
u .RegisterLocation ("firecracker" , s .shimDir .FirecrackerSockPath ())
1807
1809
@@ -2178,7 +2180,7 @@ func (s *service) SendCreateSnapRequest(createSnapReq *http.Request) error {
2178
2180
}
2179
2181
2180
2182
// 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 !
2182
2184
func (s * service ) Offload (ctx context.Context , req * proto.OffloadRequest ) (* empty.Empty , error ) {
2183
2185
2184
2186
if ! s .snapLoaded {
0 commit comments