Changeset 215694 in webkit


Ignore:
Timestamp:
Apr 24, 2017 2:11:44 PM (7 years ago)
Author:
sbarati@apple.com
Message:

ASSERTION FAILED: m_table seen with workers/wasm-hashset LayoutTests
https://bugs.webkit.org/show_bug.cgi?id=171119
<rdar://problem/31760635>

Reviewed by Keith Miller.

The HashSet of timer set notification callbacks can be accessed
and augmented simultaneously from different threads. e.g, the worker
thread can augment it while the wasm compilation thread will
access it. Therefore, accesses must be guarded by a lock.

  • runtime/JSRunLoopTimer.cpp:

(JSC::JSRunLoopTimer::scheduleTimer):
(JSC::JSRunLoopTimer::addTimerSetNotification):
(JSC::JSRunLoopTimer::removeTimerSetNotification):

  • runtime/JSRunLoopTimer.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r215689 r215694  
     12017-04-24  Saam Barati  <sbarati@apple.com>
     2
     3        ASSERTION FAILED: m_table seen with workers/wasm-hashset LayoutTests
     4        https://bugs.webkit.org/show_bug.cgi?id=171119
     5        <rdar://problem/31760635>
     6
     7        Reviewed by Keith Miller.
     8
     9        The HashSet of timer set notification callbacks can be accessed
     10        and augmented simultaneously from different threads. e.g, the worker
     11        thread can augment it while the wasm compilation thread will
     12        access it. Therefore, accesses must be guarded by a lock.
     13
     14        * runtime/JSRunLoopTimer.cpp:
     15        (JSC::JSRunLoopTimer::scheduleTimer):
     16        (JSC::JSRunLoopTimer::addTimerSetNotification):
     17        (JSC::JSRunLoopTimer::removeTimerSetNotification):
     18        * runtime/JSRunLoopTimer.h:
     19
    1202017-04-24  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp

    r215353 r215694  
    105105    CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + intervalInSeconds.seconds());
    106106    m_isScheduled = true;
     107    auto locker = holdLock(m_timerCallbacksLock);
    107108    for (auto& task : m_timerSetCallbacks)
    108109        task->run();
     
    143144    m_timer.startOneShot(intervalInSeconds);
    144145    m_isScheduled = true;
     146
     147    auto locker = holdLock(m_timerCallbacksLock);
    145148    for (auto& task : m_timerSetCallbacks)
    146149        task->run();
     
    157160void JSRunLoopTimer::addTimerSetNotification(TimerNotificationCallback callback)
    158161{
     162    auto locker = holdLock(m_timerCallbacksLock);
    159163    m_timerSetCallbacks.add(callback);
    160164}
     
    162166void JSRunLoopTimer::removeTimerSetNotification(TimerNotificationCallback callback)
    163167{
     168    auto locker = holdLock(m_timerCallbacksLock);
    164169    m_timerSetCallbacks.remove(callback);
    165170}
  • trunk/Source/JavaScriptCore/runtime/JSRunLoopTimer.h

    r215353 r215694  
    6363    bool isScheduled() const { return m_isScheduled; }
    6464
     65    // Note: The only thing the timer notification callback cannot do is
     66    // call scheduleTimer(). This will cause a deadlock. It would not
     67    // be hard to make this work, however, there are no clients that need
     68    // this behavior. We should implement it only if we find that we need it.
    6569    JS_EXPORT_PRIVATE void addTimerSetNotification(TimerNotificationCallback);
    6670    JS_EXPORT_PRIVATE void removeTimerSetNotification(TimerNotificationCallback);
     
    8892#endif
    8993
     94    Lock m_timerCallbacksLock;
    9095    HashSet<TimerNotificationCallback> m_timerSetCallbacks;
    9196   
Note: See TracChangeset for help on using the changeset viewer.