Connections hang in SSL negotiation when GssEncryptionMode=Prefer (default) on Linux without Kerberos, causing OOM
I maintainer di solito rispondono entro 6 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by tracing the reported path from ConnectAsync through RawOpen, NegotiateEncryption, SetupEncryption, and SslStream.ForceAuthenticationAsync; reproduce on Alpine Linux without Kerberos with the default GssEncryptionMode. Done means connections complete or fail cleanly instead of hanging and accumulating, while GssEncryptionMode=Disable remains only the reported workaround.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
After upgrading to Npgsql 10, services running on Alpine Linux containers (without Kerberos) experience a memory leak that leads to OOM kills. The root cause is the new default GssEncryptionMode=Prefer — Npgsql 10 attempts GSSAPI negotiation on every new connection, and on Linux without libgssapi_krb5.so.2, connections hang indefinitely during the SSL fallback.
Environment
- Npgsql version: 10.0.2 (pulled transitively via
Npgsql.OpenTelemetry 10.0.2) - Previous Npgsql version: 9.0.4 (unaffected)
- Runtime: .NET 9, Alpine Linux containers
- GssEncryptionMode: not set (default
Prefer)
Observed behavior
Connections get stuck permanently at:
ConnectAsync → RawOpen → NegotiateEncryption → SetupEncryption → SslStream.ForceAuthenticationAsync
Heap analysis with dotnet-dump showed:
- 70
NpgsqlConnectorinstances accumulating in ~29 minutes - GC roots tracing through
Timer → TimerCallback → ... → SslStream.ForceAuthenticationAsync - Connections are never completed, never disposed, never GC'd
Memory growth is continuous and eventually causes OOM kills in Kubernetes.
Expected behavior
On systems without Kerberos, GSSAPI negotiation should fail fast and fall back gracefully — connections should complete or fail cleanly, not hang indefinitely.
Workaround
Adding GssEncryptionMode=Disable to the connection string resolves the issue completely. Memory stabilizes immediately. Confirmed in multiple production services.
Comparison with Npgsql 9.x
Npgsql 9.0.4 (no GSSAPI support) does not exhibit this behavior — connections complete successfully.
Additional context
Discovered while investigating OOM kills across multiple Kubernetes services after an unintentional upgrade to Npgsql 10 via Npgsql.OpenTelemetry 10.0.2. The hang only occurs on Linux without Kerberos and is fully reproducible.
- Lingua principale
- C#
- Stelle
- 3.7k
- Fork
- 890
- Merge medio
- 4g 11h
- PR unite (30g)
- 19
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Nessuna 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 npgsql/npgsql
-
Writing a decimal as numeric allocates a short[9] per valueForse già presa @tamasprincz97-dot l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 89/100
I maintainer di solito rispondono entro 6 giorni
-
Reading a large interval as TimeSpan returns a wrong value instead of throwingForse già presa @Mr444-dev l’ha presa 7 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
npgsql/npgsql#6569 · 2 commenti ·
I maintainer di solito rispondono entro 6 giorni
-
ReadReplicationSlot returns the slot name as passed, not the one the server readForse già presa @Brar l’ha presa 8 giorni fa. Apertareplication
npgsql/npgsql#6735 · 1 assegnatario ·
I maintainer di solito rispondono entro 6 giorni
Tutte le issue di npgsql/npgsql
Issue simili
-
Issue-Bug Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
JiaFeiMiao-K-Cat/DiscImageStudio#281 ·
I maintainer di solito rispondono entro 1 giorno
-
area/access-management Frontend onboarding candidate :handshake:
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Altinn/altinn-auth#4941 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/aws-sdk-net#4586 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno