-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] dev server panics when binding to 0.0.0.0 in docker container #595
Comments
👍 We had to add that issue since Linux can sometimes reuse ports nowadays, but as part of forcing port to not get reassigned we have to open a socket to it to put it in a certain status. I would have expected this to work given https://pkg.go.dev/net#Dial:
So I am guessing Go cannot find the "local system" address in this situation. We will investigate... |
diff --git a/temporalcli/devserver/freeport.go b/temporalcli/devserver/freeport.go
index 9acca84..b360c57 100644
--- a/temporalcli/devserver/freeport.go
+++ b/temporalcli/devserver/freeport.go
@@ -44,7 +44,11 @@ func GetFreePort(host string) (int, error) {
// ports, making an extra connection just to reserve a port might actually
// be harmful (by hastening ephemeral port exhaustion).
if runtime.GOOS != "darwin" && runtime.GOOS != "windows" {
- r, err := net.DialTCP("tcp", nil, l.Addr().(*net.TCPAddr))
+ tcpAddr, err := net.ResolveTCPAddr("tcp", fmt.Sprintf("%s:%d", host, port))
+ if err != nil {
+ return 0, fmt.Errorf("Error resolving address: %e", err)
+ }
+ r, err := net.DialTCP("tcp", nil, tcpAddr)
if err != nil {
return 0, fmt.Errorf("failed to assign a free port: %v", err)
} Yeah, I was able to get it working locally with this change (not a ton of testing though). |
@cawalch Can you please confirm you are able to reproduce this issue while running Docker on your mac? I totally understand the theory behind this error, but for some reason, I'm struggling to reproduce it either on mac or linux, which is kind of essential so that I can validate a fix. If you don't mind sharing some details on your Docker/network setup, that could help me getting there more efficiently… e.g.: is that with Docker Desktop/a Brew installation/something else? Content of your Docker's daemon.json file (that relates to networking/ipv6)? Etc. Just give me anything that you feel could be pertinent. Thanks. |
@mjameswh This appears only to be an issue for our devs running Rancher Desktop (MacOS). I wasn't able to reproduce on my personal Mac running Docker Desktop. Rancher Desktop Versions
Container Engine |
Thank you very much, @cawalch. That's very useful. |
I was able to reproduce the issue on a Mac M2, no ipv6 connection, with the following procedure:
I have not found a way to reproduce with Docker Desktop, even with Kubernetes enabled. |
What are you really trying to do?
Bind the temporal dev server on 0.0.0.0
Describe the bug
When attempting to start the temporal dev server within a debian docker container (provided in the repo), a panic occurs when attempting to bind to
0.0.0.0
.This may have been related to #564 since the panic did not occur in the previous version.
Minimal Reproduction
Environment/Versions
Model Name: MacBook Pro
Model Identifier: Mac15,11
Model Number: MRW33LL/A
Chip: Apple M3 Max
Total Number of Cores: 14 (10 performance and 4 efficiency)
Memory: 36 GB
System Firmware Version: 10151.101.3
OS Loader Version: 10151.101.3
The text was updated successfully, but these errors were encountered: