Weird issue: Server does not call .publish() when client calls .subscribe()?


#1

When my client starts up, it subscribes to two small collections that are needed across all routes. All routes will wait on these subs to be ready before rendering.

After upgrading to 1.3.4.1 sometimes this wait takes forever.
I discovered this is due to the fact that the subscribe call on the client never results in a publish call on the server. When the client executes

this.tagsSubscrition = this.subscribe( 'tags', language, store );

…I can see the DDP Message, for example:

["{\"msg\":\"sub\",\"id\":\"hkznizhRAPyjjzRjn\",\"name\":\"tags\",\"params\":[\"en\",\"foobar\"]}"]

But the server, which has:

import { Meteor } from 'meteor/meteor'

Meteor.publish( 'tags', function( language, route ) {
   console.log( "Tags ", language, route );
   ....do stuff....
   let tags = Tags.find( { value: { $in: storeTags } }, { fields } );
   return tags;
} );

…doesn’t even log the console.log line. So the publish function is not even called. And there is no DDP response message what so ever for sub hkznizhRAPyjjzRjn

And thus, since the app is waiting for this sub to be ready before proceeding, everything stops.

The funny thing is that if I make a code change that causes a hot reload, the subscription works and the app is OK.
But if I then press reload to reload the whole app, it fails again.

I’m kind of stumped at the moment. Any tips anyone??


#2

Still confused. I installed ddp-analyzer-proxy on the server, here is a typical client loading:

 2  OUT  67  {"msg":"connect","version":"1","support":["1","pre2","pre1"]}
 2  IN   5  {"msg":"connected","session":"siETeAKyWZ3a6Ad2B"}
 2  IN   6  {"msg":"added","collection":"roles","id":"KHXCxzKcbiMJ2pAEb","fields":{"name":"commercial"}}
 2  IN   1  {"msg":"added","collection":"roles","id":"FZSdeoa2oEomX5hvh","fields":{"name":"organization"}}
 2  IN   0  {"msg":"added","collection":"roles","id":"MFKHuZnjrTvRRxKKc","fields":{"name":"agent"}}
 2  IN   1  {"msg":"added","collection":"roles","id":"niLRQJBKvot7zdyeM","fields":{"name":"store-owner"}}
 2  IN   0  {"msg":"added","collection":"roles","id":"ob7qcTiAvWzKHNKFB","fields":{"name":"admin"}}
 2  OUT  38  {"msg":"method","method":"headersToken","params":[1467461468494.123],"id":"1"}
 2  OUT  1  {"msg":"method","method":"headersToken","params":[1467461468113.9512],"id":"2"}
 2  OUT  0  {"msg":"method","method":"getCountryHolidays","params":["se"],"id":"3"}
 2  OUT  1  {"msg":"sub","id":"epM5jZqp74A4wfvPS","name":"meteor.loginServiceConfiguration","params":[]}
 2  OUT  1  {"msg":"sub","id":"76GfMCdPmxzHyrWXH","name":"_roles","params":[]}
 2  OUT  0  {"msg":"sub","id":"4JHQXaCu9NQ24xFhr","name":"meteor_autoupdate_clientVersions","params":[]}
 2  OUT  0  {"msg":"sub","id":"rxYt9kxNBesiq8LPC","name":"ownedthings","params":[""]}
 2  OUT  1  {"msg":"sub","id":"CNd7GuZhFwJyP5jgp","name":"userData","params":[]}
 2  OUT  0  {"msg":"sub","id":"nkzjqiR5mSQnKgoDQ","name":"stores","params":[]}
 2  OUT  0  {"msg":"sub","id":"s8q6KyepjcvsQEPwH","name":"tags","params":["en","filippa"]}
 2  IN   10  {"msg":"updated","methods":["1"]}
 2  IN   0  {"msg":"result","id":"1"}
 2  IN   2  {"msg":"updated","methods":["2"]}
 2  IN   3  {"msg":"result","id":"2"}
 2  IN   3  {"msg":"updated","methods":["3"]}
 2  IN   2  {"msg":"result","id":"3","result":{}}
 2  IN   0  {"msg":"added","collection":"meteor_accounts_loginServiceConfiguration","id":"9ksq8Lp6ENMNe4ZLs","fields":{"service":"facebook","appId":"x","loginStyle":"popup"}}
 2  IN   0  {"msg":"added","collection":"meteor_accounts_loginServiceConfiguration","id":"nphhuMwHFKgdtJCbd","fields":{"service":"google","clientId":"x","loginStyle":"popup"}}
 2  IN   1  {"msg":"ready","subs":["epM5jZqp74A4wfvPS"]}
 2  IN   1  {"msg":"ready","subs":["76GfMCdPmxzHyrWXH"]}
 1  IN   15023  {"msg":"ping"}
 2  IN   29925  {"msg":"ping"}
 2  OUT  16  {"msg":"pong"}
 2  OUT  22498  {"msg":"ping"}
 2  IN   3  {"msg":"pong"}
 2  IN   22488  {"msg":"ping"}
 2  OUT  12  {"msg":"pong"}

As you can see, the loginServiceConfiguration and Roles subscriptions get serviced. After this nothing happens. The connection just does the normal ping/pong. So there are 5 subscriptions after those two that just are not happening. The publish() methods are not called :frowning:


#3

Does the file with the publishment get executed?


#4

Yes, it put a log output just before the .publish(). It is called at server startup.