Skip to content

Charts cache is not resilient to running several Helm instances in parallel #7600

Closed

Description

@misha-ridge

I have noticed the following failure in CI logs:

Error: file '/var/lib/jenkins/workspace/Main builds/PR checks@2/_build/helm/cache/helm/repository/nginx-ingress-1.24.7.tgz' does not appear to be a gzipped archive; got 'application/octet-stream'

Our build system runs several helm commands in parallel. It appears that one of them tried to access the cached chart file while another was writing to it (checking timestamps in log files and on the filesystem supports this conclusion).

It looks like writing a chart file to a Helm cache is not atomic, and analysis of source code supports that: ChartDownloader.DownloadTo opens the target file and writes to it.

I am going to submit a PR that makes sure that ChartDownloader.DownloadTo writes the file to the filesystem atomically (via temp file + rename), so helm will never see the partial file.

Output of helm version:

version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.12-gke.25", GitCommit:"654de8cac69f1fc5db6f2de0b88d6d027bc15828", GitTreeState:"clean", BuildDate:"2020-01-14T06:01:20Z", GoVersion:"go1.12.11b4", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.): GKE

Activity

  1. changed the title [-]Putting a downloading file in a cache is not resilient to running several Helm instances in parallel[/-] [+]Charts cache is not resilient to running several Helm instances in parallel[/+] on Feb 15, 2020
  2. czunker commented on Feb 20, 2020

    @czunker

    Are these related? databus23/helm-diff#177

  3. misha-ridge commented on Feb 20, 2020

    @misha-ridge
    Author

    In that bugreport a file name is missing in the path, so it's a separate issue.

  4. added a commit that references this issue on May 8, 2020
    f68c282
  5. added a commit that references this issue on Oct 2, 2020
    cac8a32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions