Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Issue creating tarball: tar: Failed to clean up compressor #35

Closed
mfahlen opened this issue Feb 26, 2020 · 13 comments
Closed

Issue creating tarball: tar: Failed to clean up compressor #35

mfahlen opened this issue Feb 26, 2020 · 13 comments

Comments

@mfahlen
Copy link

mfahlen commented Feb 26, 2020

I am running the following task on a self-hosted agent with Windows 10, the latest version of Azure CLI (2.1.0), and the latest version of azure-devops extension (0.17.0):

steps:
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreAndSaveCacheV1.RestoreAndSaveCache@1
  displayName: 'Restore and save artifact based on: UserManager/yarn.lock'
  inputs:
    keyfile: UserManager/yarn.lock
    targetfolder: 'UserManager/node_modules'
    vstsFeed: 'af0142af-0b95-4f50-99ed-1ccc89207d06'

The post-job which is supposed to save artifacts to cache fails with:

Issue creating tarball:
     tar: Failed to clean up compressor

This is what's logged by the task when enabling debug output:

2020-02-26T12:16:48.1005120Z ##[debug]Evaluating condition for step: 'Restore and save artifact based on: UserManager/yarn.lock'
2020-02-26T12:16:48.1007273Z ##[debug]Evaluating: AlwaysNode()
2020-02-26T12:16:48.1007798Z ##[debug]Evaluating AlwaysNode:
2020-02-26T12:16:48.1010038Z ##[debug]=> True
2020-02-26T12:16:48.1010839Z ##[debug]Result: True
2020-02-26T12:16:48.1011602Z ##[section]Starting: Restore and save artifact based on: UserManager/yarn.lock
2020-02-26T12:16:48.1166343Z ==============================================================================
2020-02-26T12:16:48.1166753Z Task         : Restore and save cache
2020-02-26T12:16:48.1167092Z Description  : Restores and saves a folder given a specified key.
2020-02-26T12:16:48.1167395Z Version      : 1.0.18
2020-02-26T12:16:48.1167616Z Author       : Microsoft Corp
2020-02-26T12:16:48.1167838Z Help         : 
2020-02-26T12:16:48.1168127Z ==============================================================================
2020-02-26T12:16:48.4325554Z ##[debug]agent.TempDirectory=C:\agent\_work\_temp
2020-02-26T12:16:48.4396662Z ##[debug]loading inputs and endpoints
2020-02-26T12:16:48.4402189Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2020-02-26T12:16:48.4413702Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2020-02-26T12:16:48.4417138Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2020-02-26T12:16:48.4419231Z ##[debug]loading INPUT_DRYRUN
2020-02-26T12:16:48.4420928Z ##[debug]loading INPUT_FEEDLIST
2020-02-26T12:16:48.4422554Z ##[debug]loading INPUT_KEYFILE
2020-02-26T12:16:48.4424311Z ##[debug]loading INPUT_PLATFORMINDEPENDENT
2020-02-26T12:16:48.4426143Z ##[debug]loading INPUT_TARGETFOLDER
2020-02-26T12:16:48.4427717Z ##[debug]loading INPUT_VERBOSITY
2020-02-26T12:16:48.4432905Z ##[debug]loaded 9
2020-02-26T12:16:48.4445202Z ##[debug]Agent.ProxyUrl=undefined
2020-02-26T12:16:48.4446083Z ##[debug]Agent.CAInfo=undefined
2020-02-26T12:16:48.4446430Z ##[debug]Agent.ClientCert=undefined
2020-02-26T12:16:48.4446825Z ##[debug]Agent.SkipCertValidation=undefined
2020-02-26T12:16:48.6807897Z ##[debug]Agent.ProxyUrl=undefined
2020-02-26T12:16:48.6808301Z ##[debug]Agent.CAInfo=undefined
2020-02-26T12:16:48.6808641Z ##[debug]Agent.ClientCert=undefined
2020-02-26T12:16:48.6810472Z ##[debug]check path : C:\agent\_work\_tasks\RestoreAndSaveCache_50759521-9c5e-4f40-9ae7-8f9876ba9439\1.0.18\node_modules\azure-pipelines-tool-lib\lib.json
2020-02-26T12:16:48.6812219Z ##[debug]adding resource file: C:\agent\_work\_tasks\RestoreAndSaveCache_50759521-9c5e-4f40-9ae7-8f9876ba9439\1.0.18\node_modules\azure-pipelines-tool-lib\lib.json
2020-02-26T12:16:48.6812858Z ##[debug]system.culture=en-US
2020-02-26T12:16:48.7166149Z ##[debug]check path : C:\agent\_work\_tasks\RestoreAndSaveCache_50759521-9c5e-4f40-9ae7-8f9876ba9439\1.0.18\task.json
2020-02-26T12:16:48.7167112Z ##[debug]adding resource file: C:\agent\_work\_tasks\RestoreAndSaveCache_50759521-9c5e-4f40-9ae7-8f9876ba9439\1.0.18\task.json
2020-02-26T12:16:48.7167677Z ##[debug]system.culture=en-US
2020-02-26T12:16:48.7193055Z ##[debug]Agent.JobStatus=Succeeded
2020-02-26T12:16:48.7193462Z ##[debug]System.PullRequest.IsFork=False
2020-02-26T12:16:48.7202043Z ##[debug]keyfile=C:\agent\_work\1\s\UserManager\yarn.lock
2020-02-26T12:16:48.7205446Z ##[debug]targetfolder=C:\agent\_work\1\s\UserManager\node_modules
2020-02-26T12:16:48.7206065Z ##[debug]System.DefaultWorkingDirectory=C:\agent\_work\1\s
2020-02-26T12:16:48.7210485Z ##[debug]defaultRoot: 'C:\agent\_work\1\s'
2020-02-26T12:16:48.7211152Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
2020-02-26T12:16:48.7211643Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
2020-02-26T12:16:48.7212098Z ##[debug]findOptions.followSymbolicLinks: 'false'
2020-02-26T12:16:48.7212906Z ##[debug]matchOptions.debug: 'false'
2020-02-26T12:16:48.7213290Z ##[debug]matchOptions.nobrace: 'true'
2020-02-26T12:16:48.7213665Z ##[debug]matchOptions.noglobstar: 'false'
2020-02-26T12:16:48.7214053Z ##[debug]matchOptions.dot: 'true'
2020-02-26T12:16:48.7216842Z ##[debug]matchOptions.noext: 'false'
2020-02-26T12:16:48.7217217Z ##[debug]matchOptions.nocase: 'true'
2020-02-26T12:16:48.7217583Z ##[debug]matchOptions.nonull: 'false'
2020-02-26T12:16:48.7217986Z ##[debug]matchOptions.matchBase: 'false'
2020-02-26T12:16:48.7218390Z ##[debug]matchOptions.nocomment: 'false'
2020-02-26T12:16:48.7218779Z ##[debug]matchOptions.nonegate: 'false'
2020-02-26T12:16:48.7219161Z ##[debug]matchOptions.flipNegate: 'false'
2020-02-26T12:16:48.7219684Z ##[debug]pattern: 'C:\agent\_work\1\s\UserManager\yarn.lock'
2020-02-26T12:16:48.7243808Z ##[debug]findPath: 'C:\agent\_work\1\s\UserManager\yarn.lock'
2020-02-26T12:16:48.7244247Z ##[debug]statOnly: 'true'
2020-02-26T12:16:48.7245517Z ##[debug]found 1 paths
2020-02-26T12:16:48.7245851Z ##[debug]applying include pattern
2020-02-26T12:16:48.7253636Z ##[debug]1 matches
2020-02-26T12:16:48.7254301Z ##[debug]1 final results
2020-02-26T12:16:48.7254963Z ##[debug]Found key file: C:\agent\_work\1\s\UserManager\yarn.lock
2020-02-26T12:16:48.7255474Z ##[debug]System.DefaultWorkingDirectory=C:\agent\_work\1\s
2020-02-26T12:16:48.7255898Z ##[debug]defaultRoot: 'C:\agent\_work\1\s'
2020-02-26T12:16:48.7256332Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
2020-02-26T12:16:48.7256785Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
2020-02-26T12:16:48.7257235Z ##[debug]findOptions.followSymbolicLinks: 'false'
2020-02-26T12:16:48.7257629Z ##[debug]matchOptions.debug: 'false'
2020-02-26T12:16:48.7258005Z ##[debug]matchOptions.nobrace: 'true'
2020-02-26T12:16:48.7258404Z ##[debug]matchOptions.noglobstar: 'false'
2020-02-26T12:16:48.7258796Z ##[debug]matchOptions.dot: 'true'
2020-02-26T12:16:48.7259156Z ##[debug]matchOptions.noext: 'false'
2020-02-26T12:16:48.7259531Z ##[debug]matchOptions.nocase: 'true'
2020-02-26T12:16:48.7259895Z ##[debug]matchOptions.nonull: 'false'
2020-02-26T12:16:48.7260280Z ##[debug]matchOptions.matchBase: 'false'
2020-02-26T12:16:48.7260660Z ##[debug]matchOptions.nocomment: 'false'
2020-02-26T12:16:48.7261056Z ##[debug]matchOptions.nonegate: 'false'
2020-02-26T12:16:48.7261438Z ##[debug]matchOptions.flipNegate: 'false'
2020-02-26T12:16:48.7261871Z ##[debug]pattern: 'C:\agent\_work\1\s\UserManager\node_modules'
2020-02-26T12:16:48.7262415Z ##[debug]findPath: 'C:\agent\_work\1\s\UserManager\node_modules'
2020-02-26T12:16:48.7262808Z ##[debug]statOnly: 'true'
2020-02-26T12:16:48.7263119Z ##[debug]found 1 paths
2020-02-26T12:16:48.7263430Z ##[debug]applying include pattern
2020-02-26T12:16:48.7263748Z ##[debug]1 matches
2020-02-26T12:16:48.7264031Z ##[debug]1 final results
2020-02-26T12:16:48.7267162Z ##[debug]


-----------------------------
2020-02-26T12:16:48.7267613Z ##[debug]Found target folder: UserManager\node_modules
2020-02-26T12:16:48.7268045Z ##[debug]-----------------------------



2020-02-26T12:16:48.7274226Z ##[debug]Absolute path for pathSegments: C:\agent\_work\1\s\UserManager\yarn.lock = C:\agent\_work\1\s\UserManager\yarn.lock
2020-02-26T12:16:48.7295153Z ##[debug]platformIndependent=false
2020-02-26T12:16:48.7313174Z ##[debug]win32-1b7f9a7f0689b46356c235d9493ede2498f44f3a14b7eea2ffbcab135ec02bea=false
2020-02-26T12:16:48.7325524Z Creating cache entry for:  win32-1b7f9a7f0689b46356c235d9493ede2498f44f3a14b7eea2ffbcab135ec02bea
2020-02-26T12:16:48.7326140Z ##[debug]System.DefaultWorkingDirectory=C:\agent\_work\1\s
2020-02-26T12:16:48.7327326Z ##[debug]testing directory 'C:\agent\_work\1\s\tmp_cache'
2020-02-26T12:16:48.7328746Z ##[debug]testing directory 'C:\agent\_work\1\s'
2020-02-26T12:16:48.7329682Z ##[debug]mkdir 'C:\agent\_work\1\s\tmp_cache'
2020-02-26T12:16:49.0425444Z Issue creating tarball:
2020-02-26T12:16:49.0425900Z     tar: Failed to clean up compressor
2020-02-26T12:16:49.0426083Z 
2020-02-26T12:16:49.0426517Z ##[debug]rm -rf C:\agent\_work\1\s\tmp_cache
2020-02-26T12:16:49.0427198Z ##[debug]removing directory
2020-02-26T12:16:49.0548894Z ##[section]Finishing: Restore and save artifact based on: UserManager/yarn.lock

"where tar" gives me the following and shouldn't be the issue:

c:\Windows\System32\tar.exe

Any idea why this task is failing for me? I appreciate any help.

@ethanis
Copy link
Member

ethanis commented Feb 26, 2020

Sorry that you're running into this!

My first guess would be that this is a permissions issue and bsdtar (the tar that's bundled with Win10) has very unhelpful error messages. Could you try running the build agent in an elevated command prompt to prove/disprove this?

@mfahlen
Copy link
Author

mfahlen commented Feb 26, 2020

I have tried that now, but I still get the same error message. Is there anything else I could do to try to locate the problem? Thanks.

@ethanis
Copy link
Member

ethanis commented Feb 26, 2020

I've heard other reports of this but I haven't been able to repro it myself. My best guidance at the moment would be to use Azure DevOp's built in Pipeline Caching which is the successor to these tasks. Since you only need to cache a single directory, the built in caching functionality should work like a charm.

Based on the build step you shared above, this should work for you.

- task: Cache@2
  displayName: Cache
  inputs:
    key: '$(Agent.OS) | yarn | UserManager/yarn.lock'
    path: 'UserManager/node_modules'
    cacheHitVar: 'PACKAGES_RESTORED'

@mfahlen
Copy link
Author

mfahlen commented Feb 27, 2020

Thank you. Switching to the built in Pipeline Caching worked for me.

@mfahlen mfahlen closed this as completed Feb 27, 2020
@jamesga1
Copy link

jamesga1 commented Mar 9, 2020

@ethanis I have the same issue as @mfahlen and tried switching to using Cache@2, but I run into the problem of it not recognizing ng or nx (nrwl) commands when cached. Any advice on how to recognize those during the pipeline?

Tasks:

- task: Cache@2
  inputs:
    key: 'version3 | npm | "$(Agent.OS)" | $(workingDirectory)\package-lock.json'
    restoreKeys: |
       npm | "$(Agent.OS)"
       npm
    path: $(Pipeline.Workspace)/.npm
    cacheHitVar: CACHE_RESTORED
  displayName: Cache npm

- script: npm ci
  workingDirectory: $(workingDirectory)
  condition: ne(variables.CACHE_RESTORED, 'true')
  displayName: Install dependencies only if there is no cache available

- script: npm run affected:test -- --base=origin/master --parallel
  displayName: 'Testing affected apps'
  workingDirectory: $(workingDirectory)

Error:

 nx affected:test "--base=origin/master" "--parallel"

'nx' is not recognized as an internal or external command,

Note: setting the cache to node_modules and the install script to "npm install" does work, but I saw that it's not recommended.

@ethanis
Copy link
Member

ethanis commented Mar 11, 2020

@jamesga1 since you're restoring the .npm directory (npm's machine cache), you will still need to run npm ci on a cache hit to populate the node_modules directory for the repository. If you remove the condition from the npm ci script, things should work.

You'll still get benefits from caching because you won't be making a network call for each package as each package is resolvable from npm's cache.

@temparnak
Copy link

@ethanis , I am having the exact error in our Build pipeline. But we use pool of "Azure Pipelines" and agent specification "windows-2019"

Issue creating tarball: tar: Failed to clean up compressor

Any hope to troubleshoot this.

Note: I also tried using the Pipeline Caching task but feel its very slow and doesn't support pattern matching for folder paths. This is useful since we have "node_modules" in several folders in our solution.

@ethanis
Copy link
Member

ethanis commented Apr 23, 2020

@temparnak sorry to hear you're running into this! Can you share your build definition and build logs?

Note: pattern matching should be coming soon to the official caching tasks 🎉

@temparnak
Copy link

@ethanis Here is the task definition. Have attached the build log.

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreAndSaveCacheV1.RestoreAndSaveCache@1
  displayName: 'Restore and save artifact based on: yarn.lock'
  inputs:
    keyfile: yarn.lock
    targetfolder: 'node_modules'
    vstsFeed: 'xxxxxxx'

Build-Post-RestoreSaveTask-11.txt

@ethanis
Copy link
Member

ethanis commented Apr 27, 2020

@temparnak nothing in the build logs indicate something that would fail. Unfortunately, I'm not able to reproduce this, so I'm not quite sure how I can help further 😦

Would it be possible to build your project on linux instead? I'm curious if the caching step would succeed there instead.

@temparnak
Copy link

Unfortunately, our solution is based on .net framework, I think Linux won't help.

On the bright side, I have setup Pipeline Cache task in our build job and it seems to work. Better than no cache, but it can't keep up to the speed of the Artifact Caching task.

@ethanis
Copy link
Member

ethanis commented Apr 27, 2020

I wish I could help more here, but I'm glad you have at least some caching working!

@AtgSimonChan
Copy link

I found if pipeline run at Linux os (e.g ubuntu-20.04) was fine,
and it was fail if run at Windows 10

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

No branches or pull requests

5 participants