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

Possible memory-leak within ui-angular#AuthenticatorService (Angular SSR) #6293

Open
4 tasks done
QuentinFchx opened this issue Jan 10, 2025 · 1 comment
Open
4 tasks done
Labels
Angular An issue or a feature-request for Angular platform Authenticator An issue or a feature-request for an Authenticator UI Component pending-triage Issue is pending triage

Comments

@QuentinFchx
Copy link

QuentinFchx commented Jan 10, 2025

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

Angular

Which UI component?

Authenticator, Primitive components

How is your app built?

@angular/cli

What browsers are you seeing the problem on?

No response

Which region are you seeing the problem in?

No response

Please describe your bug.

I'm using the AmplifyUI library within a server-side rendered Angular application.
I'm seeing a constant memory increase on the machines running the server code until they crash
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory.

After some quick fiddling with the Chrome memory profiler, I strongly suspect something in the amplify-related packages to trigger the issue.
Please note that I'm not very proficient with heap snapshots interpretation.

What's the expected behaviour?

No memory leak

Help us reproduce the bug!

I've created a repository that reproduces the bug https://github.com/QuentinFchx/amplify-leak

ng build
node --inspect dist/amplify-leak/server/server.mjs

Open chrome://inspect
Go to localhost:4000 (refresh 1-2 times to warm the server)
Take a heap snapshot
curl http://localhost:4000\?\[1-100\] (perform 100 requests)
Take another heap snapshot

-> The memory constantly increases

Please note that :

  • I disabled the pre-rendering "prerender": false
  • The leak does not happen if I don't initialize the AuthenticatorService (remove the line private authenticator = inject(AuthenticatorService);)

Code Snippet

No response

Console log output

No response

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify UI maintainer labels Jan 10, 2025
@cwomack
Copy link
Member

cwomack commented Jan 10, 2025

Hello, @QuentinFchx and thank you for opening this issue. Greatly appreciate the sample repo and we'll investigate this/follow up with any additional questions we have.

@cwomack cwomack added Angular An issue or a feature-request for Angular platform Authenticator An issue or a feature-request for an Authenticator UI Component labels Jan 10, 2025
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify UI maintainer label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Angular An issue or a feature-request for Angular platform Authenticator An issue or a feature-request for an Authenticator UI Component pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants