Tracker troubles with subscriptions stopping (seemingly) at random


tl:dr Is there a way to prevent Tracker from stopping subscriptions ?

I have a rather complicated app with lots of Tracker autoruns inside React components. I am constantly running into problems that are caused by subscriptions stopping at (for me) incomprehensible and totally unexpected moments. When debugging using subscription handles onStop methods, I find that the stop always seems to occur inside some flushing Tracker autorun that should not be related to the subscription that is being stopped.
I know there are issues with Tracker & React, see discussion in

I am using the setTimeout-hack in my componentDidMount’s, and I use createContainer where ever possible to wrap my components, but the problems are not going away.
Sometimes it is a nice feature of Tracker that it can automatically stop underlying subscriptions, but currently it causes a lot of trouble for me.
So, I would like to know if there is a way to stop Tracker messing with my subscriptions.


I had this issue too, solution is not to subscribe to anything outside createContainer function. And you’ll be fine. If you already do that, it would be best to show a reproduction repository so we can dive in and see.


Problem is, not all my subscriptions are tied directly to React components.
For example, I have several general (support) modules that provide data to other (consumer) modules by letting these consumer modules register callbacks through which they can receive data and also trigger the support module to change its configuration to provide other data.
This last option will often lead to the support module breaking down and setting up new subscriptions.
If such a configuration-change is triggered from a deep down consumer module that is created with createContainer, the new subscription in the support module appears to become vulnerable to the Tracker autorun from the consumer module.
The only way I have found to prevent my support module subscriptions from getting stopped by the consumer modules autoruns is in my support modules to embed the creation of subscriptions in setTimeout(Meteor.subscribe(…), 0). This seems to work most of the times, but it leaves me with a very uneasy feeling.
I would really like to have an option to make Tracker ignore all subscriptions.
To me, the coupling of Tracker to subscriptions seems to be a bit of unnecessary magic that does more evil than good. I hope that once Tracker gets split out of meteor core to become an independent NPM package this coupling is removed.