Skip to content

Possible memory leak in query compiler #29774

Open

Description

@jyasskin

Bug description

I'm seeing memory use in a web crawler increase from ~100MB to ~550MB over about an hour. I have a 782MB heap timeline, but that's probably too big to send you. Just about all of the retained allocations have a stack trace ending in query_compiler_fast_bg.sqlite.mjs. These traces start from Node's processTicksAndRejections, so I can't easily see which of my queries are causing the leak.

Image

What more information would help debug this?

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

The affected program is in https://github.com/jyasskin/pbot-crawler/tree/e425ce114163520e511babb98baa3d63174c795f/fly, but this isn't a reduced test case by any means.

Expected vs. Actual Behavior

I expect the use to increase for a time and then flatten out. Instead it seems like queries are being compiled and then kept forever.

Frequency

Consistently reproducible

Does this occur in development or production?

Both development and production

Is this a regression?

I haven't tested old Prisma versions.

Workaround

None yet.

Prisma Schema & Queries

https://github.com/jyasskin/pbot-crawler/blob/e425ce114163520e511babb98baa3d63174c795f/fly/prisma/schema.prisma

Primary queries during the crawl are in https://github.com/jyasskin/pbot-crawler/blob/e425ce114163520e511babb98baa3d63174c795f/fly/src/lib/crawl.ts and https://github.com/jyasskin/pbot-crawler/blob/e425ce114163520e511babb98baa3d63174c795f/fly/src/lib/cache.ts. I haven't narrowed down which ones are leaking.

Prisma Config

import type { PrismaConfig } from "prisma";
export default {
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
  },
  datasource: {
    url: process.env.DATABASE_URL,
  },
} satisfies PrismaConfig;

Logs & Debug Info

No response

Environment & Setup

  • OS: Ubuntu under WSL
  • Database: Sqlite
  • Node.js version: v24.18.0

Prisma Version

Prisma schema loaded from prisma/schema.prisma.
prisma               : 7.8.0
@prisma/client       : 7.8.0
Operating System     : linux
Architecture         : x64
Node.js              : v24.18.0
TypeScript           : 6.0.3
Query Compiler       : enabled
PSL                  : @prisma/prisma-schema-wasm 7.8.0-6.3c6e192761c0362d496ed980de936e2f3cebcd3a
Schema Engine        : schema-engine-cli 3c6e192761c0362d496ed980de936e2f3cebcd3a (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x)
Default Engines Hash : 3c6e192761c0362d496ed980de936e2f3cebcd3a
Studio               : 0.27.3

Activity

  1. added
    kind/bug
    on Jul 23, 2026
  2. amalv35 commented on Jul 24, 2026

    @amalv35

    Hey, thanks for the report! I'm going to start looking into this . will update as I find anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions