Skip to content

Memory leak in Vue #33644

@ac-shadow

Description

@ac-shadow

Environment

  • Operating System: Linux
  • Node Version: v22.19.0
  • Nuxt Version: 4.2.0
  • CLI Version: 3.29.3
  • Nitro Version: 2.12.9
  • Package Manager: pnpm@10.18.3
  • Builder: -
  • User Config: compatibilityDate, devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-z3g1tibv?file=app%2Fapp.vue

Describe the bug

After upgrading our app from 4.1.3 to 4.2.0 it started to consume a lot of memory until it crashes.
It seems to me like the issue is caused by useFetch / useAsyncData and the recent addition of signals.

Additional context

To isolate the issue I created a minimal app using pnpm create nuxt@latest and updated the app.vue like this:

<script setup lang="ts">
const { data } = await useFetch('https://jsonplaceholder.typicode.com/todos/')
// const { data } = await useAsyncData('todos', (_nuxtApp, { signal }) => $fetch('https://jsonplaceholder.typicode.com/todos/', { signal }))
// const data = await $fetch('https://jsonplaceholder.typicode.com/todos/')
</script>

<template>
  <div>
    <NuxtRouteAnnouncer />
    <pre>{{ data }}}</pre>
  </div>
</template>

I used the node inspector and ran 10k requests with ab -n 10000 -c 5 http://127.0.0.1:3000/

Nuxt 4.1.3:

Image

Nuxt 4.2.0 - useFetch:

Image

Nuxt 4.2.0 - useAsyncData:

Image

Nuxt 4.2.0 - $fetch:

Image

More context:

Image

Logs

 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions