bshepherdson / foam-migration-test

0 stars 0 forks source link

Mixed in-and-out transaction calls causing errors #197

Closed bshepherdson closed 10 years ago

bshepherdson commented 10 years ago

From arthur...@google.com on February 18, 2014 15:27:01

Reference: b/13028291

Failed to execute 'put' on 'IDBObjectStore': The transaction has finished. dao.js:1187

Tracing into code found that the put is trying to reuse GLOBAL.TXN, which is already committed. The bug can only be repro'ed under the condition that a previous atxn() call is called.

I can't tell if the put happen midst atxn() execution, but my gut instinct tells me that it's not likely because the data is very small and DAO is very fast.

Original issue: http://code.google.com/p/foam-framework/issues/detail?id=197

bshepherdson commented 10 years ago

From k...@chromium.org on February 18, 2014 13:29:13

Try replacing the current 'withStore' method in dao.js with this:

withStore_: function(mode, fn) { if ( GLOBAL.TXN && GLOBAL.TXN.store ) { try { fn.call(this, TXN.store); return; } catch (x) { GLOBAL.TXN = undefined; } } this.withDB((function (db) { var tx = db.transaction([this.name], mode); var os = tx.objectStore(this.name); if ( GLOBAL.TXN ) GLOBAL.TXN.store = os; fn.call(this, os); }).bind(this)); },

Status: Started
Owner: arthur...@google.com
Labels: Component-Persistence

bshepherdson commented 10 years ago

From arthur...@google.com on February 18, 2014 14:03:23

rev d6d46a694213

Status: Fixed