-
Notifications
You must be signed in to change notification settings - Fork 16
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
Track computations from autoruns and ensure they're all stopped on publish stop #38
Conversation
# created from cursors inside the autorun will exist forever. | ||
while trackedComputations.length | ||
computation = trackedComputations.shift() | ||
computation?.stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is strange that this helps you, because handle
is the same as computation
and I already stop
them? So the whole idea why I collect handle
s there is to clean them up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is not the same, but then this is very strange and very problematic because it might point to a bug in server-side tracker implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitar would a reproduction repo help? I think the issue is that the computation isn't cleaned up ever because the publication isn't active nor is a computation returned from my autorun in this case. If I return a computation it does work, but can't do that since the pub needs to return a cursor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well your current implementation works only if a computation is returned from the autorun, but not if a cursor is.
Given meteorhacks:unblock is the only way to reproduce this, it seems like a race condition but I really don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well your current implementation works only if a computation is returned from the autorun, but not if a cursor is.
No, result of calling Tracker.autorun
is always a handle/computation of this autorun. It does not matter what internally is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, not sure why you want to use unblock
, BTW. There are some strange side effects and it uses a global variable I am pretty scared of seeing.
Also, please add a test which deterministically shows this problem and then how it is fixed. |
I've written some tests to ensure Meteor's multiplexers aren't left hanging around. Originally my approach was to track the computations from the subscription in the test, but I found it much cleaner to do a count of the multiplexers before + after to prove it no longer leaks. If you comment out Let me know your thoughts - happy to change approach if you think there's a better way. |
I think I found the problem. I will merge this and update stuff a bit. Thanks for finding this, reporting it, and making a PR. |
Fixes #37