[Project_owners] mozIStorageConnection - (NS_ERROR_FAILURE) [mozIStorageConnection.beginTransaction] [mozIStorageConnection.commitTransaction]

Marco Pivetta ocramius at gmail.com
Thu Jul 31 20:21:40 PDT 2008


I'm getting NS_ERROR_FAILURE from mozIStorageConnection.beginTransaction and
mozIStorageConnection.commitTransaction.

The code involved in this problem is very very very simple...

*                try
                {
                    AccountDB
                    .beginTransaction();
                }
                catch(e)
                {
                    alert(e)
                }*



*                try
                {
                    AccountDB
                    .commitTransaction();
                }
                catch(e)
                {
                    alert(e)
                }*


and

*AccountDB *

is a working *[xpconnect wrapped mozIStorageConnection]* ...

The first time that *.beginTransaction()* is launched everything works fine,
but when execution reaches* .commitTransaction()* the result is a
NS_ERROR_FAILURE:

[Exception... "Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [mozIStorageConnection.commitTransaction]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
chrome://standardogame/content/classes/Ranks.class.js :: anonymous :: line
405"  data: no]

When the code is launched again, ALSO *.beginTransaction() *causes an
NS_ERROR_FAILURE (obviously! Another transaction has been started just
before!)

[Exception... "Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [mozIStorageConnection.beginTransaction]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
chrome://standardogame/content/classes/Ranks.class.js :: anonymous :: line
79"  data: no]

Does anybody know if there's a way to discover if a transaction is already
started?
My code is strongly asynchronous because of a lot of XMLHttpRequests. I
checked it out and discovered that an alert() halting the code just before
the *.beginTransaction() *stops the errors from appearing. That means
there's some kind of lock on the database while I'm working on it. How can I
discover if there's a lock? And if there is some file lock, how could i work
with it? I need to use transactions because of 5000+ row inserts (3 minutes
of cpu usage without transactions, 3 seconds WITH transactions). Any idea?

If you need more details I'll also pastebin all the code, but I don't think
it is relevant.

-- 
Standard Ogame Project - StOgame
http://www.stogame.net
Making Ogame a better place...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20080801/e41e5348/attachment.html>


More information about the Project_owners mailing list