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

Increase maxListeners on DeltaManagerSummarizerProxy and AgentScheduler. #16216

Merged

Conversation

astegmaier
Copy link
Contributor

Description

Currently, when you load a Loop table component that is built with FluidFramework, you'll see these garbage errors in the console:

image

Because these errors mention "Memory Leak" they have been a source of confusion with our partners. Ironically, until we patched our console object to stringify all error objects, the warning message itself being logged to the console was a source of memory leaks.

This change removes the maxSafeListener check on the two classes in FluidFramework that were responsible for this noise.

The number of listeners on these classes will scale with the number of cells in your table, which could be immense. Since the "limit" is effectively N it seemed like removing the warnings was appropriate. They do very little to protect against actual memory leaks, which almost always come from failing to un-register a listener, not from adding too many.

@astegmaier astegmaier requested review from a team as code owners June 30, 2023 21:16
@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: runtime Runtime related issues base: main PRs targeted against main branch labels Jun 30, 2023
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Jun 30, 2023

@fluid-example/bundle-size-tests: +3.58 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 455.11 KB 455.8 KB +711 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 244.54 KB 245.14 KB +617 Bytes
loader.js 151.23 KB 151.62 KB +399 Bytes
map.js 47.19 KB 47.45 KB +267 Bytes
matrix.js 147.86 KB 148.19 KB +336 Bytes
odspDriver.js 93.68 KB 94 KB +328 Bytes
odspPrefetchSnapshot.js 44.51 KB 44.79 KB +283 Bytes
sharedString.js 164.77 KB 165.1 KB +332 Bytes
sharedTree2.js 243.4 KB 243.79 KB +395 Bytes
Total Size 1.71 MB 1.71 MB +3.58 KB

Baseline commit: 65c8073

Generated by 🚫 dangerJS against c25b3db

@ChumpChief
Copy link
Contributor

I don't have a particular feeling about the maximum, but it's surprising to me that you're registering listeners directly on the deltaManager - can you elaborate on what you're listening for there?

@astegmaier
Copy link
Contributor Author

I don't have a particular feeling about the maximum, but it's surprising to me that you're registering listeners directly on the deltaManager - can you elaborate on what you're listening for there?

@ChumpChief - I went ahead and messaged you privately about this.

@ChumpChief
Copy link
Contributor

@vladsud - as mentioned above I don't have a strong opinion on the max listeners, but you might have opinions on how folks should observe the "readonly" event from DeltaManager? I was somewhat surprised to see the reach to the delta manager, wondering if there's something more appropriate to observe?

@vladsud
Copy link
Contributor

vladsud commented Jul 6, 2023

I do not know much about scenario to comment, to be honest.
I think the issue is - we do not raise (it seems) "readonly" event on data stores, which means individual components of the system do not have another way to register for these events. That would be preferred method, IMHO.
Otherwise yes, we should expect a lot of registrations...

@astegmaier
Copy link
Contributor Author

I do not know much about scenario to comment, to be honest. I think the issue is - we do not raise (it seems) "readonly" event on data stores, which means individual components of the system do not have another way to register for these events. That would be preferred method, IMHO. Otherwise yes, we should expect a lot of registrations...

Thanks for taking a look! If I understand correctly, the idea of raising "readonly" events on data stores would be a good future improvement for FF, but our current pattern (listening directly to DeltaManager) is the best way of doing so at the moment. @ChumpChief - in that case, would it be okay to approve this PR?

@ChumpChief
Copy link
Contributor

I'll defer to Vlad since he owns readonly state - Vlad, are you saying that preferred approach is what should be done instead, or as some followup?

@astegmaier
Copy link
Contributor Author

@vladsud - I just returned from vacation, and I wanted to see if you could take a look at @ChumpChief 's question:

I'll defer to Vlad since he owns readonly state - Vlad, are you saying that preferred approach is what should be done instead, or as some followup?

Copy link
Contributor

@ChumpChief ChumpChief left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a side conversation with @vladsud, he is OK with continuing this pattern for now.

@ChumpChief ChumpChief merged commit e399f99 into microsoft:main Jul 20, 2023
27 checks passed
vladsud pushed a commit that referenced this pull request Jul 21, 2023
This is a follow-up PR to #16216 . In testing the fix with teams, I discovered one more noisy event listener warning that was due to registrations on the `Audience` class. In the context of a table component, we would register one "addMember" event listener per cell which quickly exceeds the default "warn" limit of 10 with a reasonable-sized table. The warnings look like this:

https://github.com/microsoft/FluidFramework/assets/1000369/411039ac-2c9c-4c0d-b567-26f39b2e9a9c

Because these errors mention "Memory Leak" they have been a source of confusion with our partners. Ironically, until we patched our console object to stringify all error objects, the warning message itself being logged to the console was a source of memory leaks.

This change removes the maxSafeListener check on the `Audience` class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: runtime Runtime related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants