make docker-postgres fails on first run: "the database system is shutting down"
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bash, docker, postgresql
- Ambito
- devops
Direzione di ricerca
La race si verifica nel target docker-postgres del Makefile, intorno alla riga 62, dove pg_isready -U cre -d cre viene eseguito dentro il contenitore cre-postgres. Leggi il comportamento di docker-entrypoint.sh citato nell'issue, poi riproduci il problema avviando un contenitore nuovo e interrogandone la disponibilità. È completato quando si aggiunge -h 127.0.0.1 a quel controllo, così che superi solo quando il vero server TCP è attivo, e le esecuzioni ripetute con contenitori nuovi non falliscono più nel passaggio psql.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
I cloned the repo and ran make install for the first time (staging branch, commit d9514e52).
It failed at the Postgres step:
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: the database system is shutting down
make[1]: *** [Makefile:36: docker-postgres] Error 2
[admin-local] ERROR: make docker-postgres failed
make: *** [Makefile:184: install] Error 1
When I ran make install again, it worked.
Cause
When the Postgres container starts for the first time, it does this:
- Starts a temporary server (only on the Unix socket, not TCP)
- Creates the user and database
- Stops the temporary server
- Starts the real server
The docker-postgres target checks with pg_isready -U cre -d cre. This checks the Unix socket, so it can say "ready" during step 1.
Then psql runs during step 3 and fails.
From docker-entrypoint.sh in the pgvector/pgvector:pg16 image:
# does not listen on external TCP/IP and waits until start finishes
set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}"
Steps to reproduce
I used a separate test container (cre-pg-test) so my real database was not affected.
Each run starts a fresh container and does the same check + psql command as the Makefile.
| Check | Runs | Failed |
|---|---|---|
pg_isready -U cre -d cre (current) |
20 | 1 |
pg_isready -h 127.0.0.1 -U cre -d cre |
20 | 0 |
The failed run gave the same error as above. It depends on timing, so it does not fail every time.
Test script
#!/bin/bash
# Usage: ./pg_race_test.sh old|fix [runs]
MODE="$1"; RUNS="${2:-5}"; fails=0
for run in $(seq 1 "$RUNS"); do
docker rm -f cre-pg-test >/dev/null 2>&1
docker run -d --name cre-pg-test -e POSTGRES_PASSWORD=password -e POSTGRES_USER=cre -e POSTGRES_DB=cre pgvector/pgvector:pg16 >/dev/null
for i in $(seq 1 30); do
if [ "$MODE" = "fix" ]; then
docker exec cre-pg-test pg_isready -h 127.0.0.1 -U cre -d cre >/dev/null 2>&1 && break
else
docker exec cre-pg-test pg_isready -U cre -d cre >/dev/null 2>&1 && break
fi
sleep 1
done
if out=$(docker exec cre-pg-test psql -U cre -d cre -c "CREATE EXTENSION IF NOT EXISTS vector;" 2>&1); then
echo "run $run: OK"
else
echo "run $run: FAILED -> $(echo "$out" | tail -1)"; fails=$((fails+1))
fi
done
docker rm -f cre-pg-test >/dev/null 2>&1
echo "== mode=$MODE : $fails / $RUNS failed =="
Suggested fix
Add -h 127.0.0.1 to the pg_isready check (Makefile line 62, same on main and staging):
- if docker exec cre-postgres pg_isready -U cre -d cre >/dev/null 2>&1; then ready=1; break; fi; \
+ if docker exec cre-postgres pg_isready -h 127.0.0.1 -U cre -d cre >/dev/null 2>&1; then ready=1; break; fi; \
The temporary server does not listen on TCP, so this check only passes when the real server is up.
Environment
- Windows 11 + WSL2 (Ubuntu 24.04)
- Docker Desktop 28.4.0
pgvector/pgvector:pg16
I can open a PR for this. Should it target main or staging?
- Lingua principale
- Python
- Stelle
- 216
- Fork
- 173
- Merge medio
- 1g 21h
- PR unite (30g)
- 21
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OWASP/OpenCRE
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
OWASP/OpenCRE#1232 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OWASP/OpenCRE#1228 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Incorrect inverse relationship type in CRE internal-link exportForse di nuovo libera @saicharan-r02 l’ha presa 8 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OWASP/OpenCRE#1215 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Map Analysis continues polling after a background job failsForse già presa @abhi2005-bit l’ha presa 10 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
OWASP/OpenCRE#1211 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OWASP/OpenCRE
Issue simili
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMarkAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
docling-project/docling-core#1067 ·
I maintainer di solito rispondono entro 3 giorni
-
correction metadata
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
acl-org/acl-anthology#11101 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] crewai tool create/install/login exit 0 when they failForse già presa @Kiko0301 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
vllm-project/compressed-tensors#1033 ·
I maintainer di solito rispondono entro 3 giorni
-
chore kaizen ui-rewrite
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
IBM/mcp-context-forge#7681 ·
I maintainer di solito rispondono entro 2 giorni