Publish / subscribe becomes non reactive after a few minutes

Hello,

This is a follow up of (After upgrade from 1.8.0.1 to 1.8.1 exception: Exception from Tracker recompute function) now that we are in desperate need of an upgrade of our application. At this stage we are trying to upgrade from version 1.8.01 to version 1.10.2.

After upgrading everything seems fine except this nasty bug.

We have narrowed the problem down and it ‘seems’ that the issue is related to Iron Route.

Our application is using Iron:route in combination with the Blaze templating engine. When we are using a route like this :

this.route(’/:environmentId?/menu/:param1?/:param2?/:param3?/:param4?/:param5?/:param6?’, {

waitOn() {

return Meteor.subscribe(‘menuContent’, this.url, true);

},

action() {

const layout = Layouts.findOne();

console.log(‘Layout from subscription’, layout);

},

});

When we interact with the application it will output the Layout from the MiniMongo:

Unfortunately after approximately five minutes a new route (different value of the URL parameter) will lead to :

As you would understand the result of the second subscription result is the problem. When a subscription after five minutes is being made, the publish function is not being triggered at all!

The publication looks like this :

Meteor.publish(‘menuContent’, function (url, isDesktop) {

check(url, String);

return Layouts.find({_id: ‘JRfphYMtQuL97k9Pd’})

});

When we remove the URL parameter or assign the URL a static value the subscription stays interactive. In other words the application works as expected.

Please advise as we are really in a desperate need of an upgrade.

Hello !

I finally found the problem. After this amount of silence related to this thread … it had to be something implementation specific and indeed it was.
Loosing subscription after five minutes was caused by the following code :

Meteor.setInterval(function() {
let newDdpInfo = {};
_.each(Meteor.server.sessions, function(val, key) {
newDdpInfo[key] = ddpInfo[key];
});
ddpInfo = newDdpInfo;
}, 5*60000);

Removed this section and the subscriptions are still alive after five minutes … Great !! This answer might help somebody else …

Ticket can be closed

1 Like

Wow nice! Luckily it wasnt Meteor xD