Skip to content

Networking issues impacting cache save/restore #267

Closed

Description

@dhadka

Since we've received a number of issues related to network issues impacting save/restore, I'm creating a "catch all" issue to track the investigation and mitigation.

Related Issues

#265 #259 #207 #200 #189

Diagnostics

The figure below shows the max server latency from our cloud storage provider for one of the storage accounts (the cache service uses 16 total, but all show similar trends). There's a clear increase in high latency requests the past two weeks or so.

image

I've escalated with our provider and they have started an investigation. I'll update here as we know more.

Activity

  1. ghost pinned this issue on Apr 20, 2020
  2. pjoe commented on Apr 21, 2020

    @pjoe

    Following here (from #265). Would be great if at least network failure was detected probably (during restore) and either the action failing or at least leaving disk empty, instead of a half restored and corrupted state on disk, that for us breaks following steps.

  3. pjoe commented on Apr 21, 2020

    @pjoe

    Is there a way to set a timeout for cache restore?

    In current situation we are burning build minutes just waiting for cache restore that eventually times out and leaves corrupted cache on disk :(

  4. alexhraber commented on Apr 22, 2020

    @alexhraber

    We're seeing this as well, restoring ~300mb of ruby gems with unpredictable delays.

    I've seen as fast as 9s (seconds), average of 15-20s, and hundreds of highs of 40s, 50s, 3m20s, 5m, using [email protected] (and other vanilla cache tags) we have ran ~10,000 cache pulls.

    I've tested switching to zstd compression, and while the compression and unpackaging is faster, we are still seeing slow retrieval swings, as high as 50 second retrieval in the ~400 tests I ran with zstd.

    cc @chrispat

  5. dhadka commented on Apr 22, 2020

    @dhadka
    ContributorAuthor

    @pjoe I've yet to try this, but the docs say you can set a step timeout that will kill the process if the step exceeds that limit. Note, however, that this will cause the step to fail. What we really need is a cache-specific timeout that will abort the restore but allow the workflow to continue, treating it like a cache miss.

    I've also been exploring socket timeouts. Here is an example of it aborting a slow download.

  6. chrispat commented on Apr 22, 2020

    @chrispat
    Contributor

    @dhadka you can set continue-on-error on the step and then use the new outcome on the steps context https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context to condition other steps.

  7. alexhraber commented on Apr 23, 2020

    @alexhraber

    Thanks for the replies to this issue -- unfortunately something like continue-on-error (while we use it elsewhere in our build) and any logic to skip on timeout are not sufficient, as this would result in a 2-3 minute bundle install instead of the 10s-5m cache pull/unzip.

    I agree that just running bundle install on every iteration is more predicatable, but we are seeing a lot of successful cache pull's at sub-20 seconds and I cannot justify aborting a long pull to reinstall the entire gem bundle.

    For us, this would only work if we set our timeout to 2 minutes -- but then we are still having jobs wait 2 minutes to pull cache to then abort and spend 2-3 more minute installing the bundle cache.

  8. alexhraber commented on Apr 24, 2020

    @alexhraber

    After playing more w/ caching, it's becoming evident that the issues we are seeing are related to data retrieval.

  9. munrocket commented on Apr 24, 2020

    @munrocket

    Here issue that was fixed and looks very similar actions/setup-node/issues/116

  10. alexhraber commented on Apr 24, 2020

    @alexhraber

    I'm getting around this currently by baking my bundle cache into a docker image with the GA self-hosted runner as the entrypoint. 👍

  11. dhadka commented on Apr 27, 2020

    @dhadka
    ContributorAuthor

    @munrocket Yes, that's part of the issue. We're using the same http-client. I already have a PR to validate the file length (#269) but am also testing out the approach used by actions/setup-node#116 to detect errors (using util.promisify(stream.pipeline)).

  12. JavierMeep commented on Apr 28, 2020

    @JavierMeep

    I am getting this error:

    [warning]Cache service responded with 500 during chunk upload.
    events.js:187
          throw er; // Unhandled 'error' event
          ^
    
    Error: EBADF: bad file descriptor, read
    Emitted 'error' event on ReadStream instance at:
        at internal/fs/streams.js:167:12
        at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5) {
      errno: -9,
      code: 'EBADF',
      syscall: 'read'
    }
    
  13. munrocket commented on Apr 28, 2020

    @munrocket

    @JavierMeep but nothing changed. Show link to your GA please.

  14. JavierMeep commented on Apr 28, 2020

    @JavierMeep

    @munrocket sorry it is in a private repo.

  15. wlabatey commented on Apr 28, 2020

    @wlabatey

    Also getting the same 500 error semi-regularly today when attempting to save caches. Project is also in a private repo.

    Here's the error message:

    [warning]Cache service responded with 500 during chunk upload.
    events.js:187
          throw er; // Unhandled 'error' event
          ^
    
    Error: EBADF: bad file descriptor, read
    Emitted 'error' event on ReadStream instance at:
        at internal/fs/streams.js:167:12
        at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5) {
      errno: -9,
      code: 'EBADF',
      syscall: 'read'
    }
    
  16. 33 remaining items

  17. mogusbi commented on Jul 10, 2020

    @mogusbi

    I'm also seeing the problem of the cache restores being very slow. It's ranging anywhere between a few seconds to 24 minutes as well as it just giving up after a period of time

    When it goes bad:
    image

    image

    When it goes really bad:
    image

    When it goes well:
    image

    Workflow in question can be found here: https://github.com/motech-development/platform/blob/master/.github/workflows/checks.yml

    Actions here: https://github.com/motech-development/platform/actions

  18. scottjacobsen commented on Jul 13, 2020

    @scottjacobsen

    I hope v3 fixes the speed issues, but it is at the point where GH should remove the recommendation to use this action to "speed up workflows" from their main documentation, or at least put a prominent warning. We've removed caching from our workflows because at best caching saves 5 minutes per job (45 compute total minutes per workflow, that we pay for), and frequently just costs much much more than that.

  19. moltar commented on Jul 14, 2020

    @moltar

    I agree with @scottjacobsen here.

    I also think GH should provide free credits to everyone who was using this action.

  20. scottjacobsen commented on Jul 15, 2020

    @scottjacobsen

    Here's the quick and dirty S3 caching I'm using for now - thought I would share. It doesn't have any bells or whistles, but It has been working well for us, with a 1GB gem cache that changes infrequently. It downloads and extracts in about 40 seconds each time. https://gist.github.com/scottjacobsen/ef7ccdf0ef48080a63e2fd4076d4e83f

  21. moltar commented on Jul 15, 2020

    @moltar

    Here's the quick and dirty S3 caching I'm using for now - thought I would share. It doesn't have any bells or whistles, but It has been working well for us, with a 1GB gem cache that changes infrequently. It downloads and extracts in about 40 seconds each time. https://gist.github.com/scottjacobsen/ef7ccdf0ef48080a63e2fd4076d4e83f

    Nice! Thank you for sharing.

    Wonder if that would speed up if you were to use azure.

    I think actions run on azure.

    Getting it in the same region would probably get it even faster.

  22. The-Compiler commented on Jul 20, 2020

    @The-Compiler

    FWIW I saw something similar the past couple of days, with cache downloading for a ~300 MB cache taking around 5 minutes (example run).

    As a workaround, it'd be great if I could specify a timeout for cache downloading - something like "please skip the cache if it's still downloading after 15 seconds".

    edit: Nevermind, this has been mentioned here before - sorry, should've skimmed through the existing replies first! 🙈

  23. dhadka commented on Jul 22, 2020

    @dhadka
    ContributorAuthor

    We've released v2.1.0 of the cache action yesterday. If you're using actions/cache@v2, you will automatically use this latest version.

    This switches from the http-client to the Azure Storage SDK for NodeJS for downloading the cache content. The http-client treated the file as one large stream, whereas the Storage SDK splits it into 4 MB chunks. In addition to being able to download the chunks in parallel, we set a 30 sec timeout on each chunk and include retries, which should hopefully restart any slow connections.

    With this new version, you'll also see it print out download progress:

    Received 0 of 1682754204 (0.0%), 0.0 MBs/sec
    Received 92274688 of 1682754204 (5.5%), 44.0 MBs/sec
    Received 218103808 of 1682754204 (13.0%), 69.3 MBs/sec
    Received 335544320 of 1682754204 (19.9%), 80.0 MBs/sec
    Received 461373440 of 1682754204 (27.4%), 88.0 MBs/sec
    Received 583008256 of 1682754204 (34.6%), 92.6 MBs/sec
    Received 675282944 of 1682754204 (40.1%), 91.9 MBs/sec
    Received 775946240 of 1682754204 (46.1%), 92.4 MBs/sec
    Received 868220928 of 1682754204 (51.6%), 91.9 MBs/sec
    Received 964689920 of 1682754204 (57.3%), 91.9 MBs/sec
    Received 1052770304 of 1682754204 (62.6%), 91.2 MBs/sec
    Received 1124073472 of 1682754204 (66.8%), 89.2 MBs/sec
    Received 1195376640 of 1682754204 (71.0%), 87.6 MBs/sec
    Received 1262485504 of 1682754204 (75.0%), 85.9 MBs/sec
    Received 1342177280 of 1682754204 (79.8%), 85.3 MBs/sec
    Received 1413480448 of 1682754204 (84.0%), 84.2 MBs/sec
    Received 1480589312 of 1682754204 (88.0%), 83.0 MBs/sec
    Received 1547698176 of 1682754204 (92.0%), 81.9 MBs/sec
    Received 1619001344 of 1682754204 (96.2%), 81.2 MBs/sec
    Received 1678559900 of 1682754204 (99.8%), 80.0 MBs/sec
    Received 1678559900 of 1682754204 (99.8%), 76.2 MBs/sec
    Received 1682754204 of 1682754204 (100.0%), 51.1 MBs/sec
    Cache Size: ~1605 MB (1682754204 B)
    
  24. dhadka commented on Jul 27, 2020

    @dhadka
    ContributorAuthor

    Closing since the v2.1.0 release should help with download issues, however, please feel free to re-open or create a new issue if download issues continue.

  25. ghost closed this as completedon Jul 27, 2020
  26. ghost unpinned this issue on Jul 27, 2020
  27. ghost added a commit that references this issue on Aug 21, 2020
  28. ghost added a commit that references this issue on Aug 22, 2020
  29. shugybugy-assaf commented on Oct 16, 2020

    @shugybugy-assaf

    @dhadka
    That's a gr8 improvement, but still not as fast as one would expect.
    Download is fast now, however untarring the cache is still VERY slow.
    It takes us whole 49s to untar only 850MB. (we cache python installation)
    On my VM it takes only 15seconds using gzip which should be slower than zstd.

    Is it possible that compression is mal-configured to a strict compression-level ? Is the disk super-duper slow on writing many files ?

    Here is the log that show the decompression step takes 49s.
    image

    The decompression command that takes 49s is (copied from the logs above)
    /bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/6b8290d8-2585-4bf3-be99-27773859afcd/cache.tzst -P -C /home/runner/work/datascience/datascience

    We use the approach explained below to cache the python installation directory
    https://medium.com/ai2-blog/python-caching-in-github-actions-e9452698e98d

  30. webern commented on Jun 12, 2021

    @webern

    This doesn't seem to be fixed to me:

    image

    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: actions/cache@v2
            with:
              path: |
                data/
                target/
                testgen/target/
                ~/.cargo/bin/
                ~/.cargo/git/
                ~/.cargo/registry/
  31. ThomasLecocq commented on Jan 6, 2022

    @ThomasLecocq

    Same question here, the environment caching is really amazing, works smooth, and the network-recovery is not the bottleneck at all. But, on Windows, extracting the TAR file takes way too long compared to macOS and linux:

    https://github.com/obspy/obspy/runs/4730492589?check_suite_focus=true

    • linux: < 10 s
    • macOS: < 30 s
    • windows: 2 minutes

    Any idea how I can make this faster ?

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions