JackAdams / meteor-transactions

App level transactions for Meteor + Mongo
http://transactions.taonova.com/
MIT License
113 stars 16 forks source link

Error, did not check() all params in _meteorTransactionsProcess #40

Closed tcastelli closed 8 years ago

tcastelli commented 9 years ago

Hi there, I've just installed this package for a simple transaction, code is like this (i'm using collection2 package too)

var txid = tx.start("start");

                   var inserted = CollectionA.insert(customerInfo,
                        {validate: false},
                        {tx: true, instant: true, overridePermissionCheck: true}
                    );
                    Meteor.users.update(
                        {_id: xxxx},
                        {$set: {customData: inserted}},
                        {tx:true, overridePermissionCheck: true}
                    );                  
                    CollectionB.find({email: "abc@abc.com"}).forEach(function (item) {
                            CollectionB.update(
                                {_id:item._id},
                                {$set: {toId: inserted}},
                                {tx:true ,overridePermissionCheck: true}
                            );
                    });

                    var inserted2 = CollectionC.insert(
                        {data:"test"},
                        {tx:true, overridePermissionCheck: true, instant: true}
                    );
                    CollectionA.update(
                        {_id: inserted, "data": {$exists: false}},
                        {$set: {"data": inserted2}},
                        {tx:true, overridePermissionCheck: true}
                    );
 tx.commit(txid, function(err,res){
                    if (!err) {
                        //call to method
                    }
                });

However the callback of commit is never called and I get this feedback from logs

Started "start" with transaction_id: ovhuicniTL7kGcSL7
Pushed update command to stack: ovhuicniTL7kGcSL7
Executed instant insert
Pushed update command to stack: ovhuicniTL7kGcSL7
Beginning commit with transaction_id: ovhuicniTL7kGcSL7
Executed update
Executed update
[Error: Did not check() all arguments during internal call to '_meteorTransactionsProcess']
Transaction (ovhuicniTL7kGcSL7) was cancelled after being inactive for 5 seconds.
Rolled back insert
Rollback reset transaction manager to clean state

The worse part, is that after the rollback, the document in CollectionA is still inserted with the last update on it, Meteor.users keeps the update and CollectionC document is deleted, producing a non desirable state :(

Am I missing something?

JackAdams commented 9 years ago

Yeah, sorry about this. This is #38 again. The rollback mechanism is broken. There's a fix coming out soon.

JackAdams commented 8 years ago

0.7.5 should fix both these issue. Just released on Atmosphere.

tcastelli commented 8 years ago

Thanks I'll check it asap! El 22/11/2015 11:18, "Brent Abrahams" notifications@github.com escribió:

0.7.5 should fix both these issue. Just released on Atmosphere.

— Reply to this email directly or view it on GitHub https://github.com/JackAdams/meteor-transactions/issues/40#issuecomment-158743311 .

JackAdams commented 8 years ago

This is fixed, right? I'll reopen it if it's not.