act icon indicating copy to clipboard operation
act copied to clipboard

Limit servers to IPv4 to make them work with WSL (only for WSL environments)

Open sh41 opened this issue 2 months ago • 0 comments

Summary

Builds on the work by @stickeegreg in #5912 and responds to the comment from @ChristopherHX to making the default network stack for the artifact and cache services tcp4 if running in WSL. Also added the option to configure via CLI flags.

Changes

  • Default behavior change:
    • WSL2: If environment variable WSL_DISTRO_NAME is set: Uses tcp4 (IPv4-only) when launching the artifact & cache services to avoid EHOSTUNREACH/ECONNREFUSED errors (see #2636 & #1866)
    • Other environments: Uses tcp (dual-stack IPv4/IPv6) as before.
  • Added --artifact-server-network and --cache-server-network CLI flags with validation for valid stack values (tcp, tcp4, tcp6)
  • Updated StartHandler() and Serve() to accept network parameter

Usage

# Use defaults (tcp4 on WSL2, tcp otherwise)
act

# On WSL2 override to use standard TCP
act --artifact-server-network tcp --cache-server-network tcp

# On non-WSL2 or if `WSL_DISTRO_NAME` isn't set for some reason: 
act --artifact-server-network tcp4 --cache-server-network tcp4

# Force IPv6 - I have no ability to test this as I don't have an ipv6 enabled machine to test on. 
act --artifact-server-network tcp6

Related Issues

Fixes #2636 - ECONNREFUSED to artifact service on WSL2
Fixes #1866 - Cache server EHOSTUNREACH on WSL2
Based on #5912 - Initial hardcoded fix

sh41 avatar Oct 29 '25 11:10 sh41