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

Prevent firing callbacks until members are destroyed #366

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

jankapunkt
Copy link
Collaborator

@jankapunkt jankapunkt commented Apr 14, 2022

I found a few errors related to #213 (cc @lynchem) when I moved to a new route and a new template is drawn.

I debugged my Templates and found that child templates of the page I "left" were not destroyed, while the page main template was destroyed correctly and the child template was also in _domrange.members.

So I started a deeper debugging session and found that Blaze._fireCallbacks(view, 'destroyed') was placed before view._domrange.destroyMembers and prevented the members from being removed, because the whole method just aborted after _fireCallbacks was called.

Placing it after them removes the members and the errors are gone, while at least our app tests are running fine.

I can't say if this is related to the errors in #213 but I can say that this was definitely a memory leak.
I also don't know where I should place tests for this to prevent future regressions (especially if we do a lot of rewrites for 3.0). Please help whoever can.

Copy link
Collaborator

@StorytellerCZ StorytellerCZ left a comment

Choose a reason for hiding this comment

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

LGTM

Blaze 2.6.1?

@jankapunkt
Copy link
Collaborator Author

I don't know, I tested for our app but I have no comparison or other setups that might break. Maybe we get some more people to test, especially those, having trouble with #213

@StorytellerCZ
Copy link
Collaborator

Let's give them some time then. I would like to see it in 2.6.1 if there are no complains.

@StorytellerCZ
Copy link
Collaborator

@jankapunkt what should be the line for changelog?

@jankapunkt
Copy link
Collaborator Author

@StorytellerCZ

  • fix destroying child templates when parent is destroyed; prevents memory leak and DOMRange "not attached" error

@lynchem
Copy link

lynchem commented Apr 18, 2022

That's great @jankapunkt , good detective work. We've never found a way of reproducing #213 so can't really help with tests. We can give it a quick test in staging and if all is order launch it. We'll know after a couple of days if it's worked as it fires pretty much daily.

And the removal of a core memory leak like this is also great news 👏🏻
When do you expect to launch it?

@jankapunkt
Copy link
Collaborator Author

From my pov we could do an RC release asap which is great for testing but that's not my call. @fredmaiaarantes what do you think?

@fredmaiaarantes
Copy link
Member

From my pov we could do an RC release asap which is great for testing but that's not my call. @fredmaiaarantes what do you think?

I also think it's worth it.

cc @denihs

@denihs denihs added this to the 2.6.1 milestone Apr 19, 2022
@denihs denihs changed the base branch from master to release-2.6.1 April 19, 2022 19:51
@denihs
Copy link
Contributor

denihs commented Apr 19, 2022

I'm going to merge this to the branch release-2.6.1 to centralize everything there. #371

@denihs denihs merged commit 81a7d81 into meteor:release-2.6.1 Apr 19, 2022
@denihs
Copy link
Contributor

denihs commented Apr 19, 2022

Guys, blaze@2.6.1-rc.0 is ready to be tested. #371

@jankapunkt
Copy link
Collaborator Author

Awesome! cc @lynchem I hope it will fix your issue as well. For the memory leak I will create a small test project for profiling next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants