Troubleshooting
When diagnosing an issue, record the gateway version (pgetcd --version), source commit, command flags, and exact error text with timestamps. Never include database passwords, private keys, or raw tenant payload values in bug reports.
Startup failures
| Symptom | Cause and fix |
|---|---|
select exactly one... | Specify exactly one mode flag (--tenant-config, --p0-fixture, or --qualification-config) and remove positional arguments |
PGETCD_DSN required | Export PGETCD_DSN in the gateway process environment |
invalid tenant configuration | Check JSON syntax, unknown or duplicate keys, field types, and the 65,536-byte file size limit |
| Listener rejected | Use explicit IP:port addresses and distinct non-zero ports for listen and diagnostics_listen |
tenant storage configuration rejected | Ensure PGETCD_DSN connects to the same database and role as the tenant JSON and uses sslmode=verify-full on every host |
| Startup ABI, identity, or readiness check failed | Verify CREATE EXTENSION pg_etcd, stored cluster_id / member_id, primary status, and pg_etcd.databases |
| Startup certification deadline reached | The 10-second startup check timed out waiting for COMMIT; inspect PostgreSQL lock or synchronous-replication waits |
Startup allows 10 seconds to certify the SQL ABI, persistent identity, and Lease readiness. It retries only when a transaction commits normally with ready = false (for example while the Lease worker finishes rebuilding). It never retries a SQL error or an unknown COMMIT.
TLS and authentication failures
Troubleshoot the two TLS hops separately:
- Client to gateway (
listenanddiagnostics_listen):- Confirm that the client certificate chains to
tls.client_caand carries the URI SANspiffe://pgetcd/tenant/<tenant>. - If
tls.server_nameis set, confirm that the client dials that exact DNS name and sends matching SNI. Iftls.server_nameis empty, confirm thatpublic_urlsand the server certificate IP SAN match the IP address dialed by the client.
- Confirm that the client certificate chains to
- Gateway to PostgreSQL (
PGETCD_DSN):- Confirm
sslmode=verify-full,sslrootcert, and hostname matching against the PostgreSQL server certificate. - Check every fallback host in
PGETCD_DSN; any plaintext or unverified TLS option causes the gateway to reject the DSN. - Do not confuse the SQL client certificate (
sslcert/sslkeyforpg_hba.conf) with the etcd tenant client certificate.
- Confirm
Readiness failures
/livez can return 200 OK while /readyz returns 503 ({"health":false}) and gRPC requests return Unavailable: tenant is not ready.
Run diag.status as the PostgreSQL administrator to inspect the typed readiness fields:
Check response.not_ready_reasons and the surrounding fields:
lease_rebuilding: Thepg_etcdbackground worker is still reconstructing full Lease TTLs after startup. Wait for rebuild to finish and re-run the transaction.worker_unavailable: Verify thatshared_preload_librariesincludespg_etcd, the database name is listed inpg_etcd.databases(at most 8 databases), andmax_worker_processeshas enough free slots.primary_required: The connected PostgreSQL instance is in recovery (pg_is_in_recovery()istrue). PointPGETCD_DSNat the primary and restart the gateway.identity_mismatch,schema_mismatch, orprofile_mismatch: The storedcluster_idormember_idinetcd.meta, or the installed extension version, does not match the gateway configuration. After a restore or database swap, verify the intended database before editingtenant.json; changing IDs merely to bypass the check can corrupt client revision history.
Capacity and Watch errors
ResourceExhaustedon KV or Lease calls: Compare the request against the resource limits (1.5 MiBgRPC receive,2,048-byte write key,8 MiBKV response tree,4,096events and8 MiBper complete revision,1,024Leases per database,4,096keys per Lease). Remember that attaching a key to a Lease also checks whether revoking the entire Lease would exceed the8 MiB/4,096-event revision budget.ResourceExhaustedorUnavailableon Watch streams: A slow consumer can exhaust its per-stream queue or the tenant’swatch_max_tenant_bytesbudget. Reconnect fromlast_processed_revision + 1, or take a newRangesnapshot if history was compacted. Note that a watcher registered with a futurestart_revisionblocks stream-level progress notifications on the same gRPC stream until that revision arrives or the watcher is canceled.
Unknown COMMIT outcomes
If the connection between the gateway and PostgreSQL drops, times out, or is canceled while COMMIT is in flight, the transaction may or may not have committed in PostgreSQL.
- The gateway never publishes a buffered response without a confirmed synchronous
COMMIT, and it never replays an unknownCOMMITautomatically. - Before retrying a non-idempotent write, the client application must read current state (
Range) or use a conditionalTxn(Compareonversionormod_revision) to check whether the earlier write already took effect. Blindly retrying a write can apply the mutation twice and allocate a second revision.
Workarounds for v0.1.0-rc2 known issues
Symptom in v0.1.0-rc2 | Cause and workaround |
|---|---|
| Watch events arrive late during sustained heavy writes | The Watch reader reads one revision per _tail_v2 transaction and shares publication slots with client requests, so near the throughput limit (about 600 ops/s on the measured host) it falls behind. The stream stays connected and catches up when writes drop. Keep sustained write rates below that level if Watch latency matters. |
Requests fail with ResourceExhausted: publication capacity exhausted | More concurrent requests than pool_size reached one gateway and some waited longer than 5 s for a slot. Raise pool_size, add a gateway, or lower client concurrency; clients should back off and retry. |
pg_etcd.so fails to load with GLIBC_2.38 not found | The prebuilt extension tarballs were compiled on Debian 13 (glibc 2.38+). On EL8/EL9, Debian 12 or Ubuntu 22.04, build the extension from source (make -C extension). |
Startup log prints "P1 incomplete" | A stale string; verify the binary and ABI with /version and SELECT etcd._abi(). |
v0.1.0-rc2 fixed two rc1 issues: the gateway no longer withdraws readiness when client requests fill pool_size, and etcdctl endpoint health now reports healthy. If /readyz still returns 503, the gateway log line tenant readiness withdrawn: <reason> names the cause.
Build and test driver issues
- On Linux, 16 P3 tests that require root privileges or cgroup mounts are gated behind the
pgetcd_p3build tag; standardgo test ./...skips or isolates them. - Historical SQL and P2 Python test runners (
tests/sql/run-p1-native.pyand the P2 storage runner) hard-code the older P1 2 MiB output limit, macOS.dylibsuffixes, or Homebrew paths; see Status — Known issues.
