diff --git a/docs/log-files.adoc b/docs/log-files.adoc index 0a2cf288..1c3499e2 100644 --- a/docs/log-files.adoc +++ b/docs/log-files.adoc @@ -59,11 +59,9 @@ The following statuses are available: | DEVTOOLS_SESSION_CLOSED | Sending devtools traffic was stopped | DOWNLOADING_FILE | User requested to download file from browser container | ENVIRONMENT_NOT_AVAILABLE | Browser with desired name and version does not exist -| FAILED_TO_KILL_VIDEO_CONTAINER | Failed to kill video container after timeout | FAILED_TO_REMOVE_CONTAINER | Failed to remove Docker container | FAILED_TO_TERMINATE_PROCESS | An error occurred while terminating driver process | INIT | Server is starting -| KILLED_VIDEO_CONTAINER | Waiting for video container to stop timed out and it was killed | LOG_LISTING | Received a request to list all log files | LOG_ERROR | An error occurred when post-processing session logs | METADATA | Metadata processing messages diff --git a/service/docker.go b/service/docker.go index 0d2cdefc..a102f9cf 100644 --- a/service/docker.go +++ b/service/docker.go @@ -123,7 +123,7 @@ func (d *Docker) StartWithCancel() (*StartedService, error) { ShmSize: getShmSize(d.Service), Privileged: d.Privileged, Resources: ctr.Resources{ - Memory: mem, + Memory: mem, NanoCPUs: cpu, }, ExtraHosts: getExtraHosts(d.Service, d.Caps), @@ -218,7 +218,7 @@ func (d *Docker) StartWithCancel() (*StartedService, error) { var publishedPortsInfo map[string]string if d.Service.PublishAllPorts { - publishedPortsInfo = getContainerPorts(d.Environment.Network, stat) + publishedPortsInfo = getContainerPorts(stat) } s := StartedService{ @@ -460,7 +460,7 @@ func getHostPort(env Environment, servicePort string, caps session.Caps, stat ty return hp } -func getContainerPorts(networkName string, stat types.ContainerJSON) map[string]string { +func getContainerPorts(stat types.ContainerJSON) map[string]string { ns := stat.NetworkSettings var exposedPorts = make(map[string]string) @@ -562,14 +562,12 @@ func stopVideoContainer(ctx context.Context, cli *client.Client, requestId uint6 } notRunning, doesNotExist := cli.ContainerWait(ctx, containerId, ctr.WaitConditionNotRunning) select { - case <-notRunning: case <-doesNotExist: + case <-notRunning: + removeContainer(ctx, cli, requestId, containerId) + return case <-time.After(env.SessionDeleteTimeout): - err = cli.ContainerRemove(ctx, containerId, types.ContainerRemoveOptions{Force: true}) - if err != nil { - log.Printf("[%d] [FAILED_TO_KILL_VIDEO_CONTAINER] [%s] [%v]", requestId, containerId, err) - } - log.Printf("[%d] [KILLED_VIDEO_CONTAINER] [%s] [%v]", requestId, containerId, err) + removeContainer(ctx, cli, requestId, containerId) return } log.Printf("[%d] [STOPPED_VIDEO_CONTAINER] [%s]", requestId, containerId)