Skip to content

Conversation

norio-nomura
Copy link
Contributor

@norio-nomura norio-nomura commented Oct 8, 2025

support socat as a listener and writer.

$ ./hack/test-port-forwarding.pl default [nc|socat [nc|socat]] [timeout]

The nc command always sets SO_REUSEPORT on the listening TCP port.
The socat command provides a reuseport option that enables SO_REUSEPORT on the listening TCP port.

Ref: #4160 (comment)

In the current code, test-port-forwarding.pl is executed twice in each job using nc and socat for comparison. Dropped an execution using nc.

@norio-nomura norio-nomura force-pushed the test-port-forwarding.pl-use-socat branch 6 times, most recently from fe0fed9 to c18012f Compare October 9, 2025 00:55
@norio-nomura
Copy link
Contributor Author

As far as I can see, tests that failed in nc were also successful in socat.
Is the instability of the port forwarding test caused by nc?

@norio-nomura norio-nomura force-pushed the test-port-forwarding.pl-use-socat branch 3 times, most recently from 76487b1 to a8100de Compare October 9, 2025 03:34
@jandubois
Copy link
Member

Is the instability of the port forwarding test caused by nc?

I'm just browsing, but this PR still has failing port forwarding tests, e.g. https://github.com/lima-vm/lima/actions/runs/18364708138/job/52315306508?pr=4170. So it looks like switching to socat does not fix them.

@norio-nomura
Copy link
Contributor Author

norio-nomura commented Oct 9, 2025

I'm just browsing, but this PR still has failing port forwarding tests, e.g. https://github.com/lima-vm/lima/actions/runs/18364708138/job/52315306508?pr=4170.

This PR does tests using both of nc and socat on the same job.
It has failed only on nc.

@norio-nomura
Copy link
Contributor Author

I guessed that the reason why nc fails is because the timeout is too short, but even if the timeout is extended to 3 seconds, nc continues to fail.

@norio-nomura
Copy link
Contributor Author

@jandubois
Copy link
Member

This PR does tests using both of nc and socat on the same job.

I'm sorry, I missed this.

I would be happy to switch to socat, even on a trial basis, to see if this helps. I'm so tired of re-running tests all the time.

@norio-nomura
Copy link
Contributor Author

the history of workflow runs by this PR: https://github.com/lima-vm/lima/actions?query=branch%3Atest-port-forwarding.pl-use-socat+workflow%3Atest

To check failed logs in the workflow on local terminal, we can use gh:
gh run list -b test-port-forwarding.pl-use-socat -w test --json conclusion,databaseId --jq '.[]|select(.conclusion=="failure")|.databaseId'|xargs -n 1 -I % sh -c "gh run view % --log-failed|awk '/\/hack\/test-port-forwarding.pl/{start=1};start==1{print}/Port forwarding rules/{start=0}'"

support `socat` as a listener and writer.

```console
$ ./hack/test-port-forwarding.pl default [nc|socat] [nc|socat]
```

The `nc` command always sets `SO_REUSEPORT` on the listening TCP port.
The `socat` command provides a `reuseport` option that enables `SO_REUSEPORT` on the listening TCP port.

Ref: lima-vm#4160 (comment)
Signed-off-by: Norio Nomura <[email protected]>

hack/test-port-forwarding.pl: Add a connection timeout option and relax it from 1 second to 3 seconds.

Signed-off-by: Norio Nomura <[email protected]>
@norio-nomura norio-nomura force-pushed the test-port-forwarding.pl-use-socat branch from a8100de to 067468e Compare October 9, 2025 06:41
@norio-nomura
Copy link
Contributor Author

the history of workflow runs by this PR: https://github.com/lima-vm/lima/actions?query=branch%3Atest-port-forwarding.pl-use-socat+workflow%3Atest

To check failed logs in the workflow on local terminal, we can use gh: gh run list -b test-port-forwarding.pl-use-socat -w test --json conclusion,databaseId --jq '.[]|select(.conclusion=="failure")|.databaseId'|xargs -n 1 -I % sh -c "gh run view % --log-failed|awk '/\/hack\/test-port-forwarding.pl/{start=1};start==1{print}/Port forwarding rules/{start=0}'"

I checked the test-port-forwarding.pl's failure log of all runs after 9394 that were able to set up socat correctly, but none of them failed in socat.

@norio-nomura
Copy link
Contributor Author

https://github.com/lima-vm/lima/actions/runs/18367831847/job/52324053793?pr=4170#step:10:673

time="2025-10-09T06:55:42Z" level=fatal msg="rootless containerd not running? (hint: use containerd-rootless-setuptool.sh install to start rootless containerd): stat /run/user/501/containerd-rootless: no such file or directory"

I often see this failure.

@norio-nomura norio-nomura marked this pull request as ready for review October 9, 2025 07:12
@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Oct 9, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 3c1b994 into lima-vm:master Oct 9, 2025
64 of 65 checks passed
@norio-nomura norio-nomura deleted the test-port-forwarding.pl-use-socat branch October 9, 2025 08:52
@norio-nomura
Copy link
Contributor Author

Thanks! 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants