Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The process '/usr/bin/tar' failed with exit code 1 -- file changed as we read it #1522

Open
F-WRunTime opened this issue Dec 19, 2024 · 1 comment

Comments

@F-WRunTime
Copy link

There is not a clear approach on how to work around this or force it to tar up the files.

I've tried force killing the running process before calling actions/cache/save and it complains files are being changed. I don't understand how best to debug this but seems like with the compression program used.

There needs to be a verbose option to see what's happening under the hood to better understand why this fails the workflow.

/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/github/actions-runner/_work/artifacts --files-from manifest.txt --use-compress-program zstdmt
/usr/bin/tar: artifacts/: file changed as we read it
Warning: Failed to save: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 1
Warning: Cache save failed.

Configuration used:

    - name: Save ${{ matrix.target }} Corpus
      if: always()
      uses: actions/cache/save@v4.2.0
      with:
        path: ${{ github.workspace }}/artifacts
        key: ${{ matrix.target }}-corpus-${{ github.run_id }}
@ljluestc
Copy link

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Build artifacts
        run: |
          # Simulate a build process that creates artifacts
          mkdir -p artifacts
          echo "Example artifact" > artifacts/example.txt

      - name: Stop processes writing to artifacts
        run: |
          # Stop any processes that might be writing to the artifacts directory
          # Replace `your-process-name` with the actual process name
          pkill -f your-process-name || true

      - name: Copy artifacts to a temporary directory
        run: |
          mkdir -p /tmp/artifacts
          cp -r artifacts/* /tmp/artifacts/

      - name: Save artifacts to cache
        id: cache-artifacts
        uses: actions/cache/save@v4
        with:
          path: /tmp/artifacts
          key: ${{ matrix.target }}-corpus-${{ github.run_id }}

      - name: Debug cache save failure
        if: steps.cache-artifacts.outputs.cache-save-failed == 'true'
        run: |
          echo "Cache save failed. Retrying..."
          # Retry the cache save step
          mkdir -p /tmp/artifacts-retry
          cp -r artifacts/* /tmp/artifacts-retry/
          tar -cvf /tmp/cache.tzst --exclude cache.tzst -C /tmp/artifacts-retry . --use-compress-program zstdmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants