Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware Caches Uploaded Files In Memory #65563

Open
KakkoiDev opened this issue May 9, 2024 · 0 comments
Open

Middleware Caches Uploaded Files In Memory #65563

KakkoiDev opened this issue May 9, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Middleware Related to Next.js Middleware Performance Anything with regards to Next.js performance.

Comments

@KakkoiDev
Copy link

Link to the code that reproduces this issue

https://github.com/KakkoiDev/try-memory-efficient-nextjs-upload-proxy

To Reproduce

  1. Open your system monitor to see how much RAM is available
  2. Start project server
  3. Upload a file
  4. Use the alternative NEXT_PUBLIC_UPLOAD_URL path, to avoid using the middleware to validate the issue disappears

Current vs. Expected behavior

Current

As the file uploads, the sent chunks are cached in memory and not released.

Expected behavior

As the data stream is sent to the server, the cached chunks are released from memory.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2
  Available memory (MB): 32012
  Available CPU cores: 6
Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: 9.1.0
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Middleware, Performance

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

My whole team experiences the same issue on their own computers.

@KakkoiDev KakkoiDev added the bug Issue was opened via the bug report template. label May 9, 2024
@github-actions github-actions bot added Middleware Related to Next.js Middleware Performance Anything with regards to Next.js performance. labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Middleware Related to Next.js Middleware Performance Anything with regards to Next.js performance.
Projects
None yet
Development

No branches or pull requests

1 participant