There was a race condition in the manipulation of the write fence by the
drop collection code. Specifically, when seeing a "drop collection"
oplog entry, OplogObserveDriver took no immediate action and instead
deferred some "should I re-poll now or later?" logic.
This allowed the write fence's oplogHandle.waitUntilCaughtUp code to
think that everything was "caught up" even though the effects of the
"drop collection" entry had not yet affected the cursor's state (by
transitioning it away from the STEADY state). The fix is to ensure that
the state-change aspects of processing the entry occur immediately; the
actual re-query is still deferred in order to not block the oplog tailer
from continuing.
Reported by: @awwx
(The previous failure can made consistently reproducible by replacing the
`Meteor.defer` that is removed by this commit with a
`Meteor.setTimeout(,200)`.)
OplogObserveDriver cannot try to directly apply these
representation-level mutations; it needs to get the entire custom type.
This implementation is overly conservative, but in practice
Meteor-originated writes shouldn't mutate EJSON custom types
anyway (they should treat them as atomic).
Make autopublish internal, as it is part of standard-app-packages
and not something we want users to think about.
Tweak the string for facts package. 'and custom' was a bit awkward.
We were previously doing this with a fork of Node in the dev bundle, but
that wouldn't help users in production.
We now expect users to use precisely v0.10.22 in production. When new
versions of Node come out, if users choose to use them before we get a
chance to put out a new Meteor, we disable websockets to work around the
most common effect of the issue instead of monkey-patching.
Add tests to check that account data is cleaned up after a session
closes.
Make `establishConnection` available to account tests.
Remove code duplication between `poll` (now called `simplePoll`) and
the async_multi `pollUntil`.
when the error callback only needs to print the exception.
Replace unsafe references to `err.stack` with
`err && err.stack || err`. This avoids throwing a secondary exception
if the original exception in `err` isn't an object (`throw(null)` and
`throw(undefined)` are legal in JavaScript), and also displays the
error object if the stack trace wasn't included.