Skip to content

@vue/apollo-option - memory leak on SSR render #1550

@amenella

Description

@amenella

Description

Hi,

We've encountered some memory leaks using @vue/apollo-option (through the related Nuxt 3 plugin : https://github.com/nuxt-modules/apollo).

After some debug we found that the context of following method is constantly increasing and seems never released:

My best call would be to first destroy the context then re-render, but this is only a feeling and I did not tried (on those lines).

This behaviour has only been seen on production (maybe due production build + traffic).

Here are some screenshot of Node.js debug mode on production, on which we can see that the memory allocation is constantly increasing:
image

The line referred in previous screenshot ☝️ led us to those particular lines:
image

Reproduction

Unfortunately I have no easy example to reproduce this issue (we are not even able to reproduce it with the same stack on a non-production environment...)

Expected behavior

No memory leak

Versions

vue - 3.3.11
@nuxtjs/apollo - 5.0.0-alpha.11
@apollo/client: 3.8.8
@vue/apollo-option: 4.0.0-beta.12
@vue/apollo-composable - 4.0.0-beta.12

Additional context

This issue seems related to some old ones (which should have fixed it):

  1. @vue/apollo-option fails during ssr #1424
  2. Memory leak with Nuxt SSR #806

We also have a specific usage of apollo client within the Nuxt app using a specific mixin to allow update of endpoint at runtime using env var, which is highly inspired from nuxt-modules/apollo#442 (comment)

Any help or hint would be appreciated, thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions