act icon indicating copy to clipboard operation
act copied to clipboard

Cache server EHOSTUNREACH

Open yknx4 opened this issue 2 years ago • 14 comments

Bug report info

act version:            0.2.46
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:
        /home/yknx4/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.20.4
        Module path:           command-line-arguments
        Main version:
        Main path:
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.46
                CGO_ENABLED:          1
                CGO_CFLAGS:
                CGO_CPPFLAGS:
                CGO_CXXFLAGS:
                CGO_LDFLAGS:
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
Docker Engine:
        Engine version:        24.0.2
        Engine runtime:        runc
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:
        OS arch:               x86_64
        OS kernel:             5.15.90.1-microsoft-standard-WSL2
        OS CPU:                16
        OS memory:             15614 MB
        Security options:
                name=seccomp,profile=builtin

Command used with act

act -s GITHUB_TOKEN="$(gh auth token)"

Describe issue

Cache is not working on WSL2, it cannot reach the server and thus all cache actions always fail.

Link to GitHub repository

No response

Workflow content

name: deps
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  deps:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: apt update
        run: sudo apt-get update
        shell: bash
      - uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libdrm2 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libuuid1 libx11-6 libx11-xcb1 libxcb-dri3-0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxkbcommon0 libxrandr2 libxrender1 libxshmfence1 libxss1 libxtst6
          version: 1.0

Relevant log output

[tests/deps] [DEBUG] type=remote-action actionDir=/home/yknx4/.cache/act/actions-cache-restore@v3 actionPath=restore workdir=/home/yknx4/src/zoobean/beanstack2 actionCacheDir=/home/yknx4/.cache/act actionName=actions-cache-restore@v3/restore containerActionDir=/var/run/act/actions/actions-cache-restore@v3/restore
[tests/deps] [DEBUG] Removing /home/yknx4/.cache/act/actions-cache-restore@v3/.gitignore before docker cp
[tests/deps] [DEBUG] /var/run/act/actions/actions-cache-restore@v3/
[tests/deps]   🐳  docker cp src=/home/yknx4/.cache/act/actions-cache-restore@v3/ dst=/var/run/act/actions/actions-cache-restore@v3/
[tests/deps] [DEBUG] Writing tarball /tmp/act2930208774 from /home/yknx4/.cache/act/actions-cache-restore@v3/
[tests/deps] [DEBUG] Stripping prefix:/home/yknx4/.cache/act/actions-cache-restore@v3/ src:/home/yknx4/.cache/act/actions-cache-restore@v3/
[tests/deps] [DEBUG] Extracting content from '/tmp/act2930208774' to '/var/run/act/actions/actions-cache-restore@v3/'
[tests/deps] [DEBUG] executing remote job container: [node /var/run/act/actions/actions-cache-restore@v3/dist/restore-only/index.js]
[tests/deps]   🐳  docker exec cmd=[node /var/run/act/actions/actions-cache-restore@v3/dist/restore-only/index.js] user= workdir=
[tests/deps] [DEBUG] Exec command '[node /var/run/act/actions/actions-cache-restore@v3/dist/restore-only/index.js]'
[tests/deps] [DEBUG] Working directory '/home/yknx4/src/zoobean/beanstack2'
[tests/deps]   💬  ::debug::Resolved Keys:
[tests/deps]   💬  ::debug::["cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72"]
[tests/deps]   💬  ::debug::Checking zstd --quiet --version
[tests/deps]   💬  ::debug::1.4.8
[tests/deps]   💬  ::debug::zstd version: 1.4.8
[tests/deps]   💬  ::debug::Resource Url: http://172.17.143.138:42599/_apis/artifactcache/cache?keys=cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72&version=9b20c9814e5d39ed5fb2bca3e82b64cef01cbcd6d355d0711cce04946822a7bd
[tests/deps]   💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: connect EHOSTUNREACH 172.17.143.138:42599
[tests/deps]   💬  ::debug::Resource Url: http://172.17.143.138:42599/_apis/artifactcache/cache?keys=cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72&version=9b20c9814e5d39ed5fb2bca3e82b64cef01cbcd6d355d0711cce04946822a7bd
[tests/deps]   💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: connect EHOSTUNREACH 172.17.143.138:42599
[tests/deps]   🚧  ::warning::Failed to restore: getCacheEntry failed: connect EHOSTUNREACH 172.17.143.138:42599
[tests/deps]   💬  ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
| Cache not found for input keys: cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72
[tests/deps]   ✅  Success - Main actions/cache/restore@v3
[tests/deps]   ⚙  ::set-output:: cache-primary-key=cache-apt-pkgs_91edd1e3afe94ade0b2f1b8baaebca72

Additional information

This is running in Windows with WSL2

yknx4 avatar Jun 15 '23 16:06 yknx4

In some environments, act cannot detect the correct IP to bind for the cache server (and artifact server).

"The correct IP" means it's accessible from Docker containers. I'm not familiar with WSL2, but I think you could try other IPs of your sub Linux system and specify it manually via act --cache-server-addr <IP>.

wolfogre avatar Jun 16 '23 01:06 wolfogre

@wolfogre Hey, I looked at it and it seems it is a little more complicated than that. It seems a docker container can't communicate with a WSL instance (The windows VM) it can only do it to the Windows host. so it can never reach the act process running locally. I'm looking for ways to fix this, either on the wsl side or maybe on the docker side. I'll let you know if I found something relevant to the project and probably add a PR to the Readme to make it run on WSL2 properly

yknx4 avatar Jun 16 '23 02:06 yknx4

I had this problem over a year ago, (not with act, but similar kind of network issue)

  • I disabled the wsl backend and switched to hyper-V
  • After I switched back to wsl backend the problem has fixed itself.

I think in my case was docker.host.internal also broken at the same time.

Somewhat offtopic, windows container would need a windows firewall rule due to network adapter setup

The wsl problem seem to be different...

host.docker.internal has a different ip inside wsl2

ChristopherHX avatar Jun 16 '23 09:06 ChristopherHX

@yknx4 I have the same problem. Did you find something?

mikicho avatar Sep 03 '23 12:09 mikicho

I also ran into this issue on macOS, but was able to solve this using

--cache-server-addr host.docker.internal

Might make sense to have that be the default on macOS?

StefanLobbenmeierObjego avatar Sep 29 '23 13:09 StefanLobbenmeierObjego

Issue is stale and will be closed in 14 days unless there is new activity

github-actions[bot] avatar Mar 28 '24 00:03 github-actions[bot]

don't

mikicho avatar Mar 28 '24 15:03 mikicho

My solution was to stop using the docker desktop. I didn't use the GUI anyway..

mikicho avatar Apr 10 '24 19:04 mikicho

had similar issue on macOS

[CI/task] 💬 ::debug::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED 172.16.0.2:55712

I also ran into this issue on macOS, but was able to solve this using

--cache-server-addr host.docker.internal

Might make sense to have that be the default on macOS?

☝️ works

leotm avatar Jul 25 '24 14:07 leotm

Issue is stale and will be closed in 14 days unless there is new activity

github-actions[bot] avatar Jan 22 '25 00:01 github-actions[bot]

Ran into this issue on WSL2. Fix was to not use the default docker network=host

act --network="bridge" --artifact-server-addr="host.docker.internal" --cache-server-addr="host.docker.internal" ...

.wslconfig

[wsl2]
localhostForwarding=true
networkingMode=mirrored
dnsTunneling=true
autoProxy=true

tjhiggins avatar Jan 28 '25 01:01 tjhiggins

act --network="bridge" --artifact-server-addr="host.docker.internal" --cache-server-addr="host.docker.internal" ...

I recommend to put this on some document. It's necessary to overcome the timeouts using WSL2

lars18th avatar Mar 05 '25 19:03 lars18th

.wslconfig

I have hard time with this bug :( Where should I put .wslconfig?

Edit: found the answer using the AI :) It should be here C:\Users\<YourUsername>\.wslconfig. Thanks for the solution <3

MuhammadSawalhy avatar Apr 11 '25 20:04 MuhammadSawalhy

Hopefully this will be fixed by #5912 (works with default WSL settings)

stickeegreg avatar Aug 21 '25 12:08 stickeegreg