temporalio / temporalio/temporal

Multiple Hosts in connection string are not handled properly (POSTGRES_SEEDS accepts only single host?)

Open
#5,693 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

potential-bug
Dominant language
Go
Stars
23.2k
Forks
1.9k
Avg merge
2d 8h
Merged PRs (30d)
228

Description

Expected Behavior

According to https://github.com/jackc/pgx/pull/545 pgx can accept multiple Postgres hosts in the format like 2.2.2.2:1,127.0.0.1,4.2.4.2
I assume that temporal passes this to a driver via POSTGRES_SEEDS env variable

Actual Behavior

From the logs I see that temporal sees string like host1,host2 as a single PG host "host1,host2" so fails to connect

temporal              | 2024-04-10T12:13:31.205Z	ERROR	Unable to connect to SQL database.	{"error": "dial tcp: lookup temporal-pg-host1,temporal-pg-host2: no such host", "logging-call-at": "handler.go:52"}

Steps to Reproduce the Problem

  1. Get some Postgres cluster in master/replica mode consists of temporal-pg-host1 and temporal-pg-host2 nodes
  2. Modify docker-compose-postgres.yml, comment out postgres container section and set POSTGRES_SEEDS=temporal-pg-host1,temporal-pg-host2
  3. Run docker compose -f docker-compose-postgres.yml up

Specifications

  • Version: Actual docker composer manifest from the official Github repo
  • Platform: MacOS, Docker Compose version v2.26.1-desktop.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with POSTGRES_SEEDS handling in the docker-compose-postgres.yml setup and trace the connection failure reported at handler.go:52. Reproduce the issue with two comma-separated hosts, then verify that the resulting PostgreSQL connection attempt treats them as separate hosts rather than one hostname.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, go, postgresql
Domain
backend, databases, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.