keystonejs / keystonejs/keystone

resource leaks in HTTP server and Prisma client shutdown

Open
#9,611 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10k
Forks
1.3k
Avg merge
19h 14m
Merged PRs (30d)
19

Description

Have a Keystone on kubernetes as a pod with database connections.
Up the pod and in docker image run npm cms:start which is in package.json scripts/
Send multiple requests to the server
Then delete the pod. I have frontend, nodered and etc.. and I can successfully implement gracefulShutdown function ot them so that they can close DB connections before getting deleted.

When shutting down, Keystone should:
Call server.close() on the HTTP server to allow existing connections to complete
Call prisma.$disconnect() to cleanly shut down the Prisma client
Exit only after all resources are properly closed

I think this info would be irrelevant, but anyway: Dockerfile: FROM node:22-slim.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting package.json's cms:start script and the Dockerfile context, then reproduce the Kubernetes pod deletion after sending multiple requests. Done means the HTTP server allows existing connections to complete, Prisma disconnects cleanly, and the process exits only after both resources are closed.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.