DanSnow / vue-recaptcha

Google ReCAPTCHA component for Vue.js
http://dansnow.github.io/vue-recaptcha/
MIT License
859 stars 134 forks source link

Module causes memory leak in Nuxt 3 with asyncContext enabled #1664

Open daniluk4000 opened 1 month ago

daniluk4000 commented 1 month ago

Description

Simple module installation in Nuxt causes memory leak with asyncContext enabled

Minimal Reproducible Example

https://github.com/daniluk4000/recaptcha-memory-leak (latest node 18 or higher)

  1. yarn install
  2. yarn debug
  3. open chrome://inspect, open profiler for node app
  4. bomb app, ex. siege -c 1 http://localhost:3000
  5. enjoy memory leak
  6. remove module
  7. retry 2-4
  8. leak is gone

System info

daniluk4000 commented 1 month ago

@DanSnow

image

This code in plugin causes memory leak on SSR. Simple typeof window check fixes this error.

Also maybe module should not initialize all those wait things on SSR at all.