angular / angular

Deliver web apps with confidence šŸš€
https://angular.dev
MIT License
96.37k stars 25.57k forks source link

DevTools cause Firefox to consume high CPU and memory on Microsoft 365 websites #55854

Open X-Celcius opened 6 months ago

X-Celcius commented 6 months ago

Is this a bug report or a feature request?

Please provide the steps to reproduce the issue [Bug Report only]

When accessing any Microsoft sharepoint or office page, Firefox starts to use around 50% CPU and uses an increasing amount of memory, way beyond 10GB after a few minutes. Disabling Angular DevTools resolves the issue.

Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]

Expected behavior: No noticeable performance impact by Angular DevTools, especially on non-Angular websites Actual behavior: Extreme resource usage on some websites when enabling Angular DevTools

Please provide a screenshot if possible [Bug Report only]

No response

Please provide the exception or error you saw [Bug Report only]

I have tried to get a memory dump or profiling session from Firefox but it is incredibly difficult given that Firefox itself starts to hang after a few seconds and the only way to get it to be responsive again is to close the tab, which will also free up all memory. 

However, I have noticed that the error started roughly 1 week ago, when I also received the latest DevTools update 1.0.16. 
This update mentions: "Adding support for inspecting Angular applications inside iframes"

When I leave the console open when loading sharepoint it reports hundreds of these messages (among other things): 
IFrame: origin https://autologon.microsoftazuread-sso.com is not in the allowed list.
or: 
IFrame: Integrated Windows Authentication failed with status code 401 (Unauthorized).

These messages do not appear once I disable the extension. 

Blind guess: 
I come to the conclusion that the IFrame-inspection causes some issue with the Microsoft SSO mechanism. I read somewhere that authorization inside IFrames requires special attention due to clickjacking attacks: https://datatracker.ietf.org/doc/html/rfc6819#section-4.4.1.9
Maybe the inspection is interfering with this?

Is this a browser-specific issue? If so, please specify the device, browser, and version. [Bug Report only]

Running Firefox 126.0 (64-Bit) on Windows 11

Description [Feature Request only]

No response

Proposed solution [Feature Request only]

No response

Alternatives considered [Feature Request only]

No response

JeanMeche commented 6 months ago

I'm not able to reproduce it (On any Office 365 apps I'm able to access with a corporate account).

I could be related to #49518

DrunkenToast commented 5 months ago

I am experiencing the same issue on Firefox. Workaround for creating site exceptions works. Or simply disabling the extension.

I do indeed believe it is related to SSO. This happens when signing into AWS/Azure SSO for clients using Microsoft.

sakonn commented 5 months ago

Hello,

I am experiencing the same issue in the Firefox dev edition, build 127.0b9 on a MacBook Pro. The issue is also occurring on the website which I use to buy railway tickets. Maybe you can try to reproduce the bug there. Steps to reproduce the bug:

  1. Open the homepage of the railway company: https://www.zssk.sk/en/
  2. Click to search for connections (it's Slovak railway so need to enter Slovak cities). For example, from BRATISLAVA to TRNAVA.
  3. Select any date and time.
  4. Click on search connections.

After these steps, I am redirected to the connections results page where the memory consumption of Firefox starts to explode and generally, the browser gets stuck. Memory usage is increasing in a few seconds in my case. I don't even need to open devtool. It's enough that the angular dev tools plugin is enabled.

ibcht commented 5 months ago

Hi,

User of Firefox 126.0.1 on Windows 11 here, with the Angular DevTools living in my extensions, I experienced a similar story when accessing mail.yahoo.com : high CPU usage, hungry for memory, after a few seconds my favorite browser becomes completely stuck. Shutting down the extension and no more issue.

I also tried the Slovak railway company @sakonn (and could even find some trips, despite my poor Slovak geography knowledges) and I can confirm it is the same.

Similarly to OP, I am not able to launch FF memory profiler fast enough as the browser become unresponsive very quickly ...

No MS SSO involved for me.

Not a big deal to me, I'm not using this extension that much nowadays but I wanted to share my experience to help others.

nickbanana commented 5 months ago

Another case, Using 126.0.6478.62 Chrome on Win11. Assess following site, which has an map Iframe in it

https://nchdb.boch.gov.tw/assets/advanceSearch/monument/20220121000004

Cause serious memory leak, and there's no obvious way to debug the source of the issue. Maybe disable the inspection into iframe if the html in the iframe doesn't have any Angular related text around (ng-app etc)

w-biggs commented 4 months ago

I'm seeing this issue as well. Some kind of majorly nasty memory leak has been going on for a while. Finally had the foresight to keep about:memory open so I could run a memory report while it's occurring, and it seems to point to this being the fault of Angular Devtools (despite the devtools not even being open):

8,391.69 MB (100.0%) -- explicit
ā”œā”€ā”€2,807.93 MB (33.46%) ā”€ā”€ heap-unclassified
ā”œā”€ā”€2,614.11 MB (31.15%) -- dom
ā”‚  ā”œā”€ā”€2,608.07 MB (31.08%) -- structured-clone-holder
ā”‚  ā”‚  ā”œā”€ā”€2,584.61 MB (30.80%) -- Messenger
ā”‚  ā”‚  ā”‚  ā”œā”€ā”€2,584.59 MB (30.80%) ā”€ā”€ {20a9bb38-ed7c-4faf-9aaf-7c5d241fd747}/sendRuntimeMessage [611493]

(this ID corresponds to Angular DevTools -- id={20a9bb38-ed7c-4faf-9aaf-7c5d241fd747}, name="Angular DevTools")

The majority of the other memory usage is garbage collection, itself being triggered by the memory leak.

I'm on Firefox 128.0.3 on Mac. This happens sporadically for me so I haven't noticed a pattern but the last two times this happened were on Microsoft 365 pages (specifically SharePoint), so it's probably the same issue OP is having.

EDIT: Re-triggered the issue and ran the profiler and I can confirm that most of the CPU usage is due to recvRuntimeMessage being triggered by runtime.sendMessage() hundreds of times per second.

igorrust commented 3 months ago

Hi, same experience as @sakonn but on the Microsoft SSO page with Angular Devtools extension enabled with Firefox, on an M3 Pro Macbook Pro: https://login.microsoftonline.com. Luckily I found out it was this extension, so I could just disable it and keep using FF instead of having to switch to Safari.

Ps. Send me a PM if you need an e-mailadress to trigger the issue/memory leak (password is not needed šŸ˜‰)

hmoratopcs commented 2 months ago

Workaround for creating site exceptions works.

@DrunkenToast, can you eleborate on how to limit this addon to certain sites in Firefox, please?

DrunkenToast commented 2 months ago

Workaround for creating site exceptions works.

@DrunkenToast, can you eleborate on how to limit this addon to certain sites in Firefox, please?

I just disable it when I don't need it

pumpkinlink commented 1 month ago

Damn, all microsoft AD login screens would completely freeze my Firefox in an apparent infinite JS loop, sometimes forcing me to force stop the firefox process. I had to go trough all my 20 extensions one by one to track the culprit was Angular Devtools.

This bug has been happening for over a year and I was just using Private Window mode for some websites as a workaround all this time. I'm on Ubuntu 24 if that helps.

If I open the dev console there's an iframe error with over 14 thousand log duplicate count (or at least that's what it shows before the browser gets frozen), it says this IFrame: origin https://autologon.microsoftazuread-sso.com is not in the allowed list. 5537 dsso.iframe.min_ola-etxskuesqyfim_hgua2.js:34:34 Image

amayer42 commented 1 month ago

Just wanted to chime in with a bit of information. I just started experiencing this issue last week. I can currently work around the issue in 2 ways. I have not seen the second option listed by anyone else yet.

Sorry that the information doesn't help out anyone on a Mac, but hopefully that extra information can help someone pinpoint the issue a bit better.

Version Info:

Firefox 131.0.3 Windows 11