RESOLVED FIXED 97738
IndexedDB: Run multiple tasks per transaction tick
https://bugs.webkit.org/show_bug.cgi?id=97738
Summary IndexedDB: Run multiple tasks per transaction tick
Joshua Bell
Reported 2012-09-26 16:19:02 PDT
IndexedDB: Pair of performance fixes
Attachments
Patch (4.12 KB, patch)
2012-09-26 16:21 PDT, Joshua Bell
no flags
Patch (2.96 KB, patch)
2012-09-27 09:13 PDT, Joshua Bell
no flags
Patch for landing (3.13 KB, patch)
2012-09-27 16:47 PDT, Joshua Bell
no flags
Patch for landing (3.06 KB, patch)
2012-09-28 09:17 PDT, Joshua Bell
no flags
Patch for landing (3.12 KB, patch)
2012-11-13 15:50 PST, Joshua Bell
no flags
Joshua Bell
Comment 1 2012-09-26 16:21:02 PDT
Joshua Bell
Comment 2 2012-09-26 16:21:31 PDT
alecflett@, dgrogan@ - can you take a look?
David Grogan
Comment 3 2012-09-26 16:47:13 PDT
Comment on attachment 165893 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=165893&action=review > Source/WebCore/ChangeLog:9 > + via profiling in string encoding (pro-tip: if it's already UChar, just memcpy); The old way doesn't provide robustness in the face of different endianness? Sorry if that's a stupid question. > Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp:293 > + size_t len = s.length() * sizeof(UChar); Is there any advantage to passing len to the Vector constructor like line 292-old does? > Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp:258 > + TaskQueue* taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue; This seems like the type of innocuous-looking change that causes some other non-robust portion of our code to start behaving non-deterministically, but I don't really know what's going on. I'll let Alec comment.
Joshua Bell
Comment 4 2012-09-26 16:57:21 PDT
(In reply to comment #3) > (From update of attachment 165893 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=165893&action=review > > > Source/WebCore/ChangeLog:9 > > + via profiling in string encoding (pro-tip: if it's already UChar, just memcpy); > > The old way doesn't provide robustness in the face of different endianness? Sorry if that's a stupid question. It's a great question, actually. The old method actually defends against different endianness by always reading/writing as big endian... which would be a breaking format change since most architectures are little endian. Derp. (I was under the impression that leveldb stores weren't portable across different-endian architectures which is why I blithely made the change.) I'll split this patch up and maybe turf this one. > > Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp:293 > > + size_t len = s.length() * sizeof(UChar); > > Is there any advantage to passing len to the Vector constructor like line 292-old does? Hrm, there probably is, since IIRC Vector has a default size. > > Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp:258 > > + TaskQueue* taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue; > > This seems like the type of innocuous-looking change that causes some other non-robust portion of our code to start behaving non-deterministically, but I don't really know what's going on. I'll let Alec comment.
WebKit Review Bot
Comment 5 2012-09-26 17:11:19 PDT
Comment on attachment 165893 [details] Patch Attachment 165893 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14018723 New failing tests: IDBLevelDBCodingTest.CompareEncodedStringsWithLength storage/indexeddb/cursor-key-order.html IDBLevelDBCodingTest.DecodeString IDBLevelDBCodingTest.DecodeIDBKeyPath
Joshua Bell
Comment 6 2012-09-27 08:59:12 PDT
(In reply to comment #5) > (From update of attachment 165893 [details]) > Attachment 165893 [details] did not pass chromium-ews (chromium-xvfb): > Output: http://queues.webkit.org/results/14018723 > > New failing tests: > IDBLevelDBCodingTest.CompareEncodedStringsWithLength > storage/indexeddb/cursor-key-order.html > IDBLevelDBCodingTest.DecodeString > IDBLevelDBCodingTest.DecodeIDBKeyPath Awesome - we do have endianness tests, which saved the day. I'll split this up and add a string endianness switch as a future perf item.
Joshua Bell
Comment 7 2012-09-27 09:13:11 PDT
Alec Flett
Comment 8 2012-09-27 11:12:18 PDT
Comment on attachment 166013 [details] Patch LGTM
Joshua Bell
Comment 9 2012-09-27 12:57:22 PDT
tony@ - r?
Tony Chang
Comment 10 2012-09-27 14:15:32 PDT
Comment on attachment 166013 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166013&action=review > Source/WebCore/ChangeLog:9 > + Process multiple tasks from the pending queue(s) when the timer fires. The > + task may initiate new tasks that change which queue is active (e.g. indexing Per times (like the time to run all the LayoutTests before/after this change) would be nice.
Joshua Bell
Comment 11 2012-09-27 16:47:44 PDT
Created attachment 166093 [details] Patch for landing
WebKit Review Bot
Comment 12 2012-09-27 17:11:07 PDT
Comment on attachment 166093 [details] Patch for landing Rejecting attachment 166093 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: Failed to run "['Tools/Scripts/update-webkit', '--chromium', '--force-update']" exit_code: 9 Updating OpenSource From http://git.chromium.org/external/Webkit 82bc0a1..e7aca46 master -> origin/master Partial-rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc ... Currently at 129817 = c176af8a903a16f338b44f42a58940a7dedc9084 last_rev is higher!: 129817 >= 129802 at /usr/lib/git-core/git-svn line 1523 Died at Tools/Scripts/update-webkit line 164. Full output: http://queues.webkit.org/results/14034982
Joshua Bell
Comment 13 2012-09-28 09:17:16 PDT
Created attachment 166265 [details] Patch for landing
WebKit Review Bot
Comment 14 2012-09-28 09:38:41 PDT
Comment on attachment 166265 [details] Patch for landing Clearing flags on attachment: 166265 Committed r129911: <http://trac.webkit.org/changeset/129911>
WebKit Review Bot
Comment 15 2012-09-28 09:38:45 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 16 2012-09-28 13:21:40 PDT
Re-opened since this is blocked by bug 97933
Joshua Bell
Comment 17 2012-09-28 13:45:12 PDT
(In reply to comment #16) > Re-opened since this is blocked by bug 97933 Two theories so far, with no evidence: * This change means that tasks may execute even before the previous task calls didCompleteTaskEvents if there's async operation in between (e.g. firing onSuccess across an IPC boundary). Possibly something is sensitive to that, as the InspectorIndexedDBAgent does explicitly call didCompleteTaskEvents(). * m_taskEventTimer.startOneShot(0) may be called repeatedly now without waiting for the previous call to fire. Perhaps there's something on Windows that's sensitive to this?
Joshua Bell
Comment 19 2012-11-13 15:50:32 PST
Created attachment 174015 [details] Patch for landing
Joshua Bell
Comment 20 2012-11-13 15:53:57 PST
Trying this again. I was never able to repro the inspector crash (locally or with the try bots). The IndexedDB inspector code has since been completely re-written; it used to use back-end APIs, and needed to explicitly poke a "private" API (didCompleteTaskEvents) to signal that tasks were complete, and some re-entrancy problem induced by this platform-specific timer behavior was my suspicion for the cause of the crash. The way the inspector talks to IDB has completely changed to only use front-end APIs, so I believe that this should be safe now. ... Gardeners - if tests start crashing after this lands, please roll it out.
WebKit Review Bot
Comment 21 2012-11-13 20:34:11 PST
Comment on attachment 174015 [details] Patch for landing Clearing flags on attachment: 174015 Committed r134529: <http://trac.webkit.org/changeset/134529>
WebKit Review Bot
Comment 22 2012-11-13 20:34:16 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.