Skip to content

fix: use 127.0.0.1 instead of localhost as default HostPort for IPv4 consistency #1957

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AmitThakkar
Copy link

What was changed

Updated the defaultHostPort constant in internal/grpc_dialer.go from:

const defaultHostPort = "localhost:7233"

to:

const defaultHostPort = "127.0.0.1:7233"

to ensure consistent and reliable connectivity in local development environments across platforms.

Why?

The default HostPort value used when connecting to the Temporal server is set to "localhost:7233". However, "localhost" may resolve to ::1 (IPv6) on some systems, while temporal server start-dev binds only to 127.0.0.1 (IPv4).

This mismatch leads to errors like:

failed reaching server: context deadline exceeded

…consistency

The default HostPort value used when connecting to the Temporal server is set to "localhost:7233". However, "localhost" may resolve to ::1 (IPv6) on some systems, while temporal server start-dev binds only to 127.0.0.1 (IPv4).
This mismatch leads me to error:
> failed reaching server: context deadline exceeded
@AmitThakkar AmitThakkar requested a review from a team as a code owner May 14, 2025 07:48
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cretz
Copy link
Member

cretz commented May 14, 2025

I am concerned this is a backwards incompatible change. If we had the SDK to design again, we probably wouldn't even have a default host:port, we'd require it be set by users (and this is what we do in newer SDKs). In the meantime, we encourage explicitly setting this value to what you need it to be and not relying on the default. I understand that samples rely on the default, but they are meant to be adapted as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants