Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dartium error with IndexedDB, inconsistent with dart2js #3130

Closed
sethladd opened this issue May 18, 2012 · 10 comments
Closed

Dartium error with IndexedDB, inconsistent with dart2js #3130

sethladd opened this issue May 18, 2012 · 10 comments
Assignees
Labels
closed-as-intended Closed as the reported issue is expected behavior P1 A high priority bug; for example, a single project is unusable or has many test failures web-libraries Issues impacting dart:html, etc., libraries
Milestone

Comments

@sethladd
Copy link
Contributor

I've attached the relevant files to repo this error, including html, compiled javascript, and dart code.

Chromium 21.0.1140.0 (Developer Build 137628)
OS Mac OS X
WebKit 537.1 (Source/WebCore/Configurations@528)
JavaScript V8 3.11.2
DartVM r7713

The attached code behaves differently in Dartium vs. when compiled to JavaScript via dart2js.

When running via dart2js, the program completes as expected.

When running in Dartium, the following error is produced:

opening db
success
version good to go for test-db
inserting objects into store00
opening mode 1 txn on store00
Numeric transaction modes are deprecated in IDBDatabase.transaction. Use "readonly" or "readwrite".
Saving 0
Exception: Error: TRANSACTION_INACTIVE_ERR: DOM IDBDatabase Exception 7
Stack Trace: 0. Function: 'FutureImpl._complete@924b4b8' url: 'bootstrap_impl' line:3091 col:9
 1. Function: 'FutureImpl._setException@924b4b8' url: 'bootstrap_impl' line:3113 col:14
 2. Function: 'CompleterImpl.completeException' url: 'bootstrap_impl' line:3174 col:30
 3. Function: 'FutureImpl.function' url: 'bootstrap_impl' line:3146 col:36
 4. Function: 'FutureImpl._complete@924b4b8' url: 'bootstrap_impl' line:3087 col:17
 5. Function: 'FutureImpl._setValue@924b4b8' url: 'bootstrap_impl' line:3101 col:14
 6. Function: 'CompleterImpl.complete' url: 'bootstrap_impl' line:3170 col:26
 7. Function: '::_initDb@2d796a66' url: 'http://127.0.0.1:3030/Users/sethladd/dart/idb-dartium/idbDartium.dart' line:54 col:23
 8. Function: '::function' url: 'http://127.0.0.1:3030/Users/sethladd/dart/idb-dartium/idbDartium.dart' line:27 col:12
 9. Function: 'EventListenerListImplementation.function' url: '/Volumes/data/b/build/slave/dartium-mac-full/build/src/dart/lib/dom/src/native_EventsImplementation.dart' line:94 col:35

Exception: Error: TRANSACTION_INACTIVE_ERR: DOM IDBDatabase Exception 7
Stack Trace: 0. Function: 'FutureImpl._complete@924b4b8' url: 'bootstrap_impl' line:3091 col:9
 1. Function: 'FutureImpl._setException@924b4b8' url: 'bootstrap_impl' line:3113 col:14
 2. Function: 'CompleterImpl.completeException' url: 'bootstrap_impl' line:3174 col:30
 3. Function: 'FutureImpl.function' url: 'bootstrap_impl' line:3146 col:36
 4. Function: 'FutureImpl._complete@924b4b8' url: 'bootstrap_impl' line:3087 col:17
 5. Function: 'FutureImpl._setValue@924b4b8' url: 'bootstrap_impl' line:3101 col:14
 6. Function: 'CompleterImpl.complete' url: 'bootstrap_impl' line:3170 col:26
 7. Function: '::_initDb@2d796a66' url: 'http://127.0.0.1:3030/Users/sethladd/dart/idb-dartium/idbDartium.dart' line:54 col:23
 8. Function: '::function' url: 'http://127.0.0.1:3030/Users/sethladd/dart/idb-dartium/idbDartium.dart' line:27 col:12
 9. Function: 'EventListenerListImplementation.function' url: '/Volumes/data/b/build/slave/dartium-mac-full/build/src/dart/lib/dom/src/native_EventsImplementation.dart' line:94 col:35


Attachments:
idbDartium.html (420 Bytes)
idbDartium.dart (3.67 KB)
idbDartium.dart.js_ (123.01 KB)

@DartBot
Copy link

DartBot commented May 18, 2012

This comment was originally written by antonm@google.com


Thanks, Seth, I assume it's an issue w/ dispatch.

Stephen, as you started on it putting you as an owner, but feel free to reassign back to me.


Set owner to @rakudrama.
Added Accepted label.

@DartBot
Copy link

DartBot commented Jun 1, 2012

This comment was originally written by antonm@google.com


Added Duplicate label.
Marked as being merged into #3353.

@rakudrama
Copy link
Member

Unmerging. I think it is more likely related to the recent idl change.


Added Accepted label.
Marked as being merged into #.

@DartBot
Copy link

DartBot commented Jun 1, 2012

This comment was originally written by antonm@google.com


Up to you. I've noticed those refernces to string vs. int too, but they looks like a warning.

I observed exactly this reports when wrong overload was choosen (w/ IDBKey vs. Range).

Stephen, what's the ETA for this bug (you're marked as an owner.)

@rakudrama
Copy link
Member

I'm still not sure what is going on here.
It seems to run the first time, but has the above error if the page is reloaded.

Anton, if you think it is a dispatch issue, can you take a look?

I will look at the string vs int problem - most of the work there is on the JavaScript side to make the various browsers compatible.


Set owner to antonm@google.com.

@DartBot
Copy link

DartBot commented Jun 5, 2012

This comment was originally written by antonm@google.com


Just ran on the freshest Dartium and got the following as an output:

zsh/3 3 (git-svn)-[r140492]-% ./out/Debug/chrome --user-data-dir=ddd ~/Downloads/idbDartium.html
[5724:5724:425455987257:WARNING:zygote_host_impl_linux.cc(165)] Running without the SUID sandbox! See http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[5726:5726:425456314114:ERROR:nss_util.cc(692)] Failed to load NSS libraries.
[5748:5748:425459582702:INFO:gl_context_glx.cc(53)] GLX_ARB_create_context_robustness supported.
[5748:5748:425459833251:INFO:gl_context_glx.cc(66)] Successfully allocated offscreen GL context with LOSE_CONTEXT_ON_RESET_ARB
[5748:5748:425459833327:INFO:gl_context_glx.cc(135)] Offscreen context was direct.
[5757:5757:425460456604:ERROR:nss_util.cc(452)] Error initializing NSS without a persistent database: libsoftokn3.so: cannot open shared object file: Permission denied
[5724:5724:425463047592:INFO:CONSOLE(0)] "opening db", source: undefined (0)
[5724:5724:425463223063:INFO:CONSOLE(0)] "success", source: undefined (0)
[5724:5724:425463239633:INFO:CONSOLE(0)] "upgrading to 1 for test-db", source: undefined (0)
[5724:5724:425463262280:INFO:CONSOLE(0)] "creating store00", source: undefined (0)
[5724:5724:425463270710:INFO:CONSOLE(0)] "creating store01", source: undefined (0)
[5724:5724:425463282067:INFO:CONSOLE(0)] "inserting objects into store00", source: undefined (0)
[5724:5724:425463284734:INFO:CONSOLE(0)] "opening mode 1 txn on store00", source: undefined (0)
[5724:5724:425463289560:INFO:CONSOLE(0)] "Numeric transaction modes are deprecated in IDBDatabase.transaction. Use "readonly" or "readwrite".", source: (0)
[5724:5724:425463300308:INFO:CONSOLE(0)] "Saving 0", source: undefined (0)
[5724:5724:425463304159:INFO:CONSOLE(0)] "put 0", source: undefined (0)
[5724:5724:425463304440:INFO:CONSOLE(0)] "Saving 1", source: undefined (0)
[5724:5724:425463305297:INFO:CONSOLE(0)] "put 1", source: undefined (0)
[5724:5724:425463305461:INFO:CONSOLE(0)] "Saving 2", source: undefined (0)
[5724:5724:425463306348:INFO:CONSOLE(0)] "put 2", source: undefined (0)
[5724:5724:425463306567:INFO:CONSOLE(0)] "Saving 3", source: undefined (0)
[5724:5724:425463307383:INFO:CONSOLE(0)] "put 3", source: undefined (0)
[5724:5724:425463309928:INFO:CONSOLE(0)] "Saving 4", source: undefined (0)
[5724:5724:425463311066:INFO:CONSOLE(0)] "put 4", source: undefined (0)
[5724:5724:425463376184:INFO:CONSOLE(0)] "txn is complete", source: undefined (0)
[5724:5724:425463377648:INFO:CONSOLE(0)] "done!", source: undefined (0)

So I think Dartium is off the hook.

Reassigning back to Stephen and changing area to DOM.


Set owner to @rakudrama.
Removed Area-Dartium label.
Added Area-DOM label.

@vsmenon
Copy link
Member

vsmenon commented Jun 22, 2012

Added this to the M1 milestone.

@rakudrama
Copy link
Member

Marked this as blocking #1310.

@iposva-google
Copy link
Contributor

Removed Area-DOM label.
Added Area-HTML label.

@rakudrama
Copy link
Member

There is a bug with the code.
The versionchange transaction needs to complete before you try to create transactions against an object store.

You might just have been lucky with timing when it worked on Dartium.
With this change I see it works on dart2js Chrome 23 and Dartium.

void _initDb(Completer completer) {
  if (version != _db.version) {
    print('upgrading ${_db.version} to $version for $dbName');
    IDBVersionChangeRequest versionChange = _db.setVersion(version);
    versionChange.on.success.add((e) {
      storeNames.forEach((storeName) {
        if (_db.objectStoreNames.indexOf(storeName) == -1) {
          print('creating $storeName');
          _db.createObjectStore(storeName);
        }
      });
      // THIS IS THE CHANGE: complete on transaction completion.
      var transaction = e.target.result;
      transaction.on.complete.add((e) { completer.complete(true); });
    });
    versionChange.on.error.add((e) {
      completer.completeException(e);
    });
  } else {
    print('version good to go for $dbName');
    completer.complete(true);
  }
}

The version change logic will also need to be upgraded to the standard upgradeneeded event protocol.


Added AsDesigned label.

@sethladd sethladd added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures web-libraries Issues impacting dart:html, etc., libraries closed-as-intended Closed as the reported issue is expected behavior labels Oct 5, 2012
@sethladd sethladd added this to the M1 milestone Oct 5, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior P1 A high priority bug; for example, a single project is unusable or has many test failures web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

5 participants