Changeset 195652 in webkit


Ignore:
Timestamp:
Jan 26, 2016 7:45:09 PM (8 years ago)
Author:
Chris Dumez
Message:

fast/history/page-cache-webdatabase-no-transaction-db.html flakily crashes
https://bugs.webkit.org/show_bug.cgi?id=153525

Reviewed by Andreas Kling.

Source/WebCore:

The test was crashing because DatabaseThread::hasPendingDatabaseActivity()
was accessing m_openDatabaseSet from the main thread without any locking
mechanism. This is an issue because m_openDatabaseSet is altered by the
database thread.

No new tests, already covered by fast/history/page-cache-webdatabase-no-transaction-db.html.

  • Modules/webdatabase/DatabaseThread.cpp:

(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::recordDatabaseOpen):
(WebCore::DatabaseThread::recordDatabaseClosed):
(WebCore::DatabaseThread::hasPendingDatabaseActivity):

  • Modules/webdatabase/DatabaseThread.h:

LayoutTests:

Unskip fast/history/page-cache-webdatabase-no-transaction-db.html now
that it no longer crashes.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r195648 r195652  
     12016-01-26  Chris Dumez  <cdumez@apple.com>
     2
     3        fast/history/page-cache-webdatabase-no-transaction-db.html flakily crashes
     4        https://bugs.webkit.org/show_bug.cgi?id=153525
     5
     6        Reviewed by Andreas Kling.
     7
     8        Unskip fast/history/page-cache-webdatabase-no-transaction-db.html now
     9        that it no longer crashes.
     10
     11        * TestExpectations:
     12
    1132016-01-26  Brady Eidson  <beidson@apple.com>
    214
  • trunk/LayoutTests/TestExpectations

    r195638 r195652  
    849849http/tests/security/contentSecurityPolicy/1.1/stylehash-default-src.html # Needs expected file.
    850850
    851 # This test flakily crashes, skip it until the crash is fixed.
    852 webkit.org/b/153525 fast/history/page-cache-webdatabase-no-transaction-db.html [ Skip ]
    853 
    854851# These state object tests purposefully stress a resource limit, and take multiple seconds to run.
    855852loader/stateobjects/pushstate-size-iframe.html [ Slow ]
  • trunk/Source/WebCore/ChangeLog

    r195649 r195652  
     12016-01-26  Chris Dumez  <cdumez@apple.com>
     2
     3        fast/history/page-cache-webdatabase-no-transaction-db.html flakily crashes
     4        https://bugs.webkit.org/show_bug.cgi?id=153525
     5
     6        Reviewed by Andreas Kling.
     7
     8        The test was crashing because DatabaseThread::hasPendingDatabaseActivity()
     9        was accessing m_openDatabaseSet from the main thread without any locking
     10        mechanism. This is an issue because m_openDatabaseSet is altered by the
     11        database thread.
     12
     13        No new tests, already covered by fast/history/page-cache-webdatabase-no-transaction-db.html.
     14
     15        * Modules/webdatabase/DatabaseThread.cpp:
     16        (WebCore::DatabaseThread::databaseThread):
     17        (WebCore::DatabaseThread::recordDatabaseOpen):
     18        (WebCore::DatabaseThread::recordDatabaseClosed):
     19        (WebCore::DatabaseThread::hasPendingDatabaseActivity):
     20        * Modules/webdatabase/DatabaseThread.h:
     21
    1222016-01-26  Joseph Pecoraro  <pecoraro@apple.com>
    223
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp

    r194496 r195652  
    118118    // Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the database in an
    119119    // inconsistent or locked state.
    120     if (m_openDatabaseSet.size() > 0) {
    121         // As the call to close will modify the original set, we must take a copy to iterate over.
    122         DatabaseSet openSetCopy;
    123         openSetCopy.swap(m_openDatabaseSet);
    124         for (auto& openDatabase : openSetCopy)
    125             openDatabase->close();
    126     }
     120    DatabaseSet openSetCopy;
     121    {
     122        LockHolder lock(m_openDatabaseSetMutex);
     123        if (m_openDatabaseSet.size() > 0) {
     124            // As the call to close will modify the original set, we must take a copy to iterate over.
     125            openSetCopy.swap(m_openDatabaseSet);
     126        }
     127    }
     128
     129    for (auto& openDatabase : openSetCopy)
     130        openDatabase->close();
    127131
    128132    // Detach the thread so its resources are no longer of any concern to anyone else
     
    140144void DatabaseThread::recordDatabaseOpen(Database* database)
    141145{
     146    LockHolder lock(m_openDatabaseSetMutex);
     147
    142148    ASSERT(currentThread() == m_threadID);
    143149    ASSERT(database);
     
    148154void DatabaseThread::recordDatabaseClosed(Database* database)
    149155{
     156    LockHolder lock(m_openDatabaseSetMutex);
     157
    150158    ASSERT(currentThread() == m_threadID);
    151159    ASSERT(database);
     
    184192bool DatabaseThread::hasPendingDatabaseActivity() const
    185193{
     194    LockHolder lock(m_openDatabaseSetMutex);
    186195    for (auto& database : m_openDatabaseSet) {
    187196        if (database->hasPendingCreationEvent() || database->hasPendingTransaction())
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.h

    r188594 r195652  
    8181    // This set keeps track of the open databases that have been used on this thread.
    8282    typedef HashSet<RefPtr<Database>> DatabaseSet;
     83    mutable Lock m_openDatabaseSetMutex;
    8384    DatabaseSet m_openDatabaseSet;
    8485
Note: See TracChangeset for help on using the changeset viewer.