Frequent server crashes with "Error: expected to be _runningOrRunScheduled"

I am in the process of migrating my app from 1.2 to 1.5. I could reproduce this nearly every time when I try to send a notification via e-mail and push notifications to mobile devices, but also when just a regular Meteor method is being called.

Sometimes it crashes multiple times (!), since it tries to resend the e-mails / push messages on startup and crashes immediately. The app is completely unusable in this condition :-/

Since I had to change a lot to get my app working in Meteor 1.5 - including migrating to raix:push 3.0.2 - there is a lot of potential root causes. Unfortunately, the error message Meteor throws does not give me a hint what happens:

/bundle/bundle/programs/server/node_modules/fibers/future.js:280
						throw(ex);
						^

Error: expected to be _runningOrRunScheduled
    at [object Object]._.extend._run (packages/meteor.js:797:13)
    at packages/meteor.js:789:14

I searched the issues in github:meteor/meteor and the raix:push package and could not find a hint there. Google did not find a valid result either. Did anyone else encounter this weird error?

Update The problem now also appeared on the local dev system, so it is not related to deployment or mup. Changed the text above accordingly.

I could now narrow down the problem to a call to Mongo DB’s update() methods. Sometimes, this call works fine, sometimes the server crashes during the call. Any ideas why this may happen?

I was able to narrow this down to the upgrade from 1.5 to 1.5.1. Up to 1.5, my app works fine, so the problem was introduced with 1.5.1.

The updater shows the following changes to the packages in 1.5.1:

accounts-base              upgraded from 1.3.0 to 1.3.1
accounts-password          upgraded from 1.3.6 to 1.4.0
allow-deny                 upgraded from 1.0.5 to 1.0.6
babel-compiler             upgraded from 6.19.1 to 6.19.4
boilerplate-generator      upgraded from 1.1.0 to 1.1.1
ddp                        upgraded from 1.2.5 to 1.3.0
ddp-client*                upgraded from 1.3.4 to 2.0.0
ddp-common                 upgraded from 1.2.8 to 1.2.9
ddp-server*                upgraded from 1.3.14 to 2.0.0
dynamic-import             upgraded from 0.1.0 to 0.1.1
ecmascript                 upgraded from 0.8.0 to 0.8.1
ecmascript-runtime-client  upgraded from 0.4.1 to 0.4.2
email                      upgraded from 1.2.1 to 1.2.3
meteor                     upgraded from 1.6.1 to 1.7.0
minimongo                  upgraded from 1.2.0 to 1.2.1
modules                    upgraded from 0.9.0 to 0.9.2
mongo                      upgraded from 1.1.18 to 1.1.19
npm-bcrypt                 upgraded from 0.9.2 to 0.9.3
shell-server               upgraded from 0.2.3 to 0.2.4
webapp                     upgraded from 1.3.16 to 1.3.17

I tried to update them one by one, in order to find the ‘culprit’. But Meteor automatically adjusts them to the version that is pinned for the respective release. Is there a way to install ‘incompatible’ packages, i.e. packages that should run with 1.5.1, but try them on a 1.5 installation?

Mhh, maybe this is related to this?

My Meteor 1.5.1 app upgraded the packages a few days ago, then I got problems with the subscriptions. Didn’t have time to test if it is related with the oplog package or an core issue, but maybe downgrading both packages solves your issue?

//Edit: Oh sorry, I see you are still on 1.1.19

Thanks for your input. I would love to downgrade specific packages to find the culprit, but Meteor won’t let me do so. Seems as if the versions are pinned to a certain Meteor release and automatically adjusted if you patch your versions file manually.