Skip to content

Failed to use act_runner with cache with error failed: socket hang up #31648

Description

@catfishlty

Description

Overview

Version

All my services are on Docker.
Gitea Instance: gitea/gitea:1.22.1, name: gitea, port: 3000
Act_runner Instance: gitea/act_runner:0.2.10, name: gitea-runner, port: 9040(for cache server)
Job Container: catthehacker/ubuntu:act-latest

Network

All these 3 containers are in one Docker network(172.18.0.0/24),
And I follow this to setup the act runner cache setting, and I'm pretty sure that Job container can connect to the cache server port testing by curl

Problems

When I use this workflow to start a action job, the job will be succeed at the end, but the cache save/restore steps always failed.
Then I catch the logs form act_runner container, even if I set the log.level to debug , I can't get the logs with more details.

Workflow

name: Test
run-name: test 🚀
on: 
  [push]

jobs:
  Release:
    runs-on: linux_amd64
    steps:
      - name: 🔎 Check out repository code
        uses: actions/checkout@v4
      - name: 💡 Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.22
          cache-dependency-path: "**/*.sum"
      - name: 🔎 Install dependencies
        run: |
          go mod tidy
      - name: 🔎 Build
        run: |
          go build -v

Config for Act Runner

# Example configuration file, it's safe to copy this as the default config file without any modification.

# You don't have to copy this file to your instance,
# just run `./act_runner generate-config > config.yaml` to generate a config file.

log:
  # The level of logging, can be trace, debug, info, warn, error, fatal
  level: info

runner:
  # Where to store the registration result.
  file: .runner
  # Execute how many tasks concurrently at the same time.
  capacity: 1
  # Extra environment variables to run jobs.
  # envs:
  # Extra environment variables to run jobs from a file.
  # It will be ignored if it's empty or the file doesn't exist.
  env_file: .env
  # The timeout for a job to be finished.
  # Please note that the Gitea instance also has a timeout (3h by default) for the job.
  # So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
  timeout: 3h
  # Whether skip verifying the TLS certificate of the Gitea instance.
  insecure: true
  # The timeout for fetching the job from the Gitea instance.
  fetch_timeout: 5s
  # The interval for fetching the job from the Gitea instance.
  fetch_interval: 2s
  # The labels of a runner are used to determine which jobs the runner can run, and how to run them.
  # Like: "macos-arm64:host" or "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
  # Find more images provided by Gitea at https://gitea.com/gitea/runner-images .
  # If it's empty when registering, it will ask for inputting labels.
  # If it's empty when execute `daemon`, will use labels in `.runner` file.
  labels:
    #- "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
    - "linux_amd64:docker://catthehacker/ubuntu:act-latest"

cache:
  # Enable cache server to use actions/cache.
  enabled: true
  # The directory to store the cache data.
  # If it's empty, the cache data will be stored in $HOME/.cache/actcache.
  dir: ""
  # The host of the cache server.
  # It's not for the address to listen, but the address to connect from job containers.
  # So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
  host: "gitea-runner"
  # The port of the cache server.
  # 0 means to use a random available port.
  port: 9040
  # The external cache server URL. Valid only when enable is true.
  # If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
  # The URL should generally end with "/".
  external_server: ""

container:
  # Specifies the network to which the container will connect.
  # Could be host, bridge or the name of a custom network.
  # If it's empty, act_runner will create a network automatically.
  network: "local_net"
  # Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
  privileged: false
  # And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
  options:
  # The parent directory of a job's working directory.
  # NOTE: There is no need to add the first '/' of the path as act_runner will add it automatically. 
  # If the path starts with '/', the '/' will be trimmed.
  # For example, if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir
  # If it's empty, /workspace will be used.
  workdir_parent:
  # Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
  # You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
  # For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
  # valid_volumes:
  #   - data
  #   - /src/*.json
  # If you want to allow any volume, please use the following configuration:
  # valid_volumes:
  #   - '**'
  valid_volumes: []
  # overrides the docker client host with the specified one.
  # If it's empty, act_runner will find an available docker host automatically.
  # If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
  # If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
  docker_host: ""
  # Pull docker image(s) even if already present
  force_pull: true
  # Rebuild docker image(s) even if already present
  force_rebuild: false

host:
  # The parent directory of a job's working directory.
  # If it's empty, $HOME/.cache/act/ will be used.
  workdir_parent:

Logs from Act Runner Container

[Test/Release] ::debug::Reserving Cache
[Test/Release]   | ::debug::Reserving Cache
[Test/Release] ::debug::Resource Url: http://gitea-runner:9040/_apis/artifactcache/caches
[Test/Release]   | ::debug::Resource Url: http://gitea-runner:9040/_apis/artifactcache/caches
[Test/Release] ::debug::reserveCache - Attempt 1 of 2 failed with error: socket hang up
[Test/Release]   | ::debug::reserveCache - Attempt 1 of 2 failed with error: socket hang up
[Test/Release] ::debug::Resource Url: http://gitea-runner:9040/_apis/artifactcache/caches
[Test/Release]   | ::debug::Resource Url: http://gitea-runner:9040/_apis/artifactcache/caches
[Test/Release] ::debug::reserveCache - Attempt 2 of 2 failed with error: socket hang up
[Test/Release]   | ::debug::reserveCache - Attempt 2 of 2 failed with error: socket hang up
[Test/Release] ::warning::Failed to save: reserveCache failed: socket hang up
[Test/Release]   | ::warning::Failed to save: reserveCache failed: socket hang up

Logs form Gitea - Actions - Log View

Setup go version spec 1.22
Found in cache @ /opt/hostedtoolcache/go/1.[2](https://{domain}/{org}/{repo}/actions/runs/5#jobstep-2-2)2.5/x64
Added go to the path
Successfully set up Go version 1.22
[command]/opt/hostedtoolcache/go/1.22.5/x6[4](https://{domain}/{org}/{repo}/actions/runs/5#jobstep-2-4)/bin/go env GOMODCACHE
[command]/opt/hostedtoolcache/go/1.22.[5](https://{domain}/{org}/{repo}/actions/runs/5#jobstep-2-5)/x64/bin/go env GOCACHE
/root/go/pkg/mod
/root/.cache/go-build
::warning::Failed to restore: getCacheEntry failed: socket hang up
Cache is not found
##[add-matcher]/run/act/actions/actions-setup-go@v5/matchers.json
go version go1.22.5 linux/amd[6](https://{domain}/{org}/{repo}/actions/runs/5#jobstep-2-6)4

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Running in Docker Engine Community

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/not-a-bugThe reported issue is the intended behavior or the problem is not inside Giteatopic/gitea-actionsrelated to the actions of Gitea

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions