Diggsey / meteor-reactive-publish

Enable server-side reactivity for Meteor.publish
MIT License
41 stars 5 forks source link

Crashes on updates of collection that is reactively queries #2

Closed yeputons closed 10 years ago

yeputons commented 10 years ago

Gist. Create a project, remove insecure and autosubscribe packages, open localhost. Try updating the only 'A' element with something. New value will blink for a moment and then server gives an error:

=> Meteor server running on: http://localhost:3000/
I20140203-12:25:46.245(4)? tryit
=> Meteor server restarted
I20140203-12:25:58.984(4)? tryit
I20140203-12:25:58.994(4)? as= [ { bId: '5yprikWWpzcd9d5aA', _id: 'ZrP9qLgnf6iMEYiJp' } ]
I20140203-12:26:41.527(4)? Exception in queued task: Error: Could not find element with id ZrP9qLgnf6iMEYiJp to change
I20140203-12:26:41.530(4)?     at _.extend.changed (packages/livedata/livedata_server.js:176)
I20140203-12:26:41.533(4)?     at _.extend.changed (packages/livedata/livedata_server.js:364)
I20140203-12:26:41.535(4)?     at _.extend.changed (packages/livedata/livedata_server.js:964)
I20140203-12:26:41.538(4)?     at cursor.observeChanges.changed (packages/reactive-publish\lib\reactive-publish.coffee:96:7)
I20140203-12:26:41.541(4)?     at packages/mongo-livedata/observe_multiplex.js:159
I20140203-12:26:41.543(4)?     at Array.forEach (native)
I20140203-12:26:41.546(4)?     at Function._.each._.forEach (packages/underscore/underscore.js:79)
I20140203-12:26:41.548(4)?     at Object.task (packages/mongo-livedata/observe_multiplex.js:153)
I20140203-12:26:41.550(4)?     at _.extend._run (packages/meteor/fiber_helpers.js:150)
I20140203-12:26:41.553(4)?     at packages/meteor/fiber_helpers.js:128
I20140203-12:26:42.425(4)? Exception in queued task: Error: Could not find element with id ZrP9qLgnf6iMEYiJp to change
I20140203-12:26:42.444(4)?     at _.extend.changed (packages/livedata/livedata_server.js:176)
I20140203-12:26:42.445(4)?     at _.extend.changed (packages/livedata/livedata_server.js:364)
I20140203-12:26:42.455(4)?     at _.extend.changed (packages/livedata/livedata_server.js:964)
I20140203-12:26:42.457(4)?     at cursor.observeChanges.changed (packages/reactive-publish\lib\reactive-publish.coffee:96:7)
I20140203-12:26:42.460(4)?     at packages/mongo-livedata/observe_multiplex.js:159
I20140203-12:26:42.463(4)?     at Array.forEach (native)
I20140203-12:26:42.466(4)?     at Function._.each._.forEach (packages/underscore/underscore.js:79)
I20140203-12:26:42.469(4)?     at Object.task (packages/mongo-livedata/observe_multiplex.js:153)
I20140203-12:26:42.470(4)?     at _.extend._run (packages/meteor/fiber_helpers.js:150)
I20140203-12:26:42.473(4)?     at packages/meteor/fiber_helpers.js:128I20140203-12:28:05.054(4)? tryit
I20140203-12:28:05.056(4)? as= [ { _id: 'ZrP9qLgnf6iMEYiJp', bId: '5yprikWWpzcd9d5aA' } ]

I have reactive: true option commented here, because if I uncomment it, server hangs after writing tryit to log. If I replace reactivePublish by publish, everything except reactive update of 'B's works fine.

Diggsey commented 10 years ago

Fixed in 59b571339f663382f560abd1e8f2ddd9ac9498f8, thanks for helping me iron out these bugs!

yeputons commented 10 years ago

@Diggsey unfortunatelly, my example still does not work ewith reactivePublish and {reactive:true} even without updates - server hangs on find({}, {reactive:true}).fetch(). But if I replace it with findOne({}, {reactive:true}), everything works OK (except that I get only one item from collection 'A')

Diggsey commented 10 years ago

Seems to be a problem with oplog tailing, for now you can fix it by adding "limit: [some sufficiently large number]" to the find options until I find an actual solution.

Diggsey commented 10 years ago

Well, it turned out to be an easier fix than I expected so enjoy! (v0.1.4)

yeputons commented 10 years ago

Cool, thank you. One more issue, btw: #3 :)