From: commit-queue@webkit.org Date: Thu, 13 Dec 2012 11:00:12 +0000 (+0000) Subject: [EFL] Remove redundant pipe write to prevent pipe buffer full. X-Git-Tag: 2.1_release~296 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75f8ddbaf34c195071156596662f42199fc32d39;p=platform%2Fframework%2Fweb%2Fwebkit-efl.git [EFL] Remove redundant pipe write to prevent pipe buffer full. https://bugs.webkit.org/show_bug.cgi?id=101135 Patch by Byungwoo Lee on 2012-12-13 Reviewed by Gyuyoung Kim. To prevent a source of a deadlock, remove the redundant pipe write in wakeUp() function. EFL uses ecore_pipe_write() to wake up main run loop, and the function uses POSIX pipe write with O_NONBLOCK disabled. With O_NONBLOCK disabled, when written data is more than PIPE_BUF, pipe write will be blocked until it can be written. Currently, every wakeUp() function calls ecore_pipe_write() to invoke wakeUpEvent() callback. And this can make pipe buffer full status which is the one reason of the lockup problem described in Bug 99494. * platform/RunLoop.h: (RunLoop): * platform/efl/RunLoopEfl.cpp: (WebCore::RunLoop::RunLoop): (WebCore::RunLoop::wakeUpEvent): (WebCore::RunLoop::wakeUp): Change-Id: I0c46a64d885c929cb2ac265d4b0da020cd3db9a7 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137580 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index c8e7ad5..1cc0e9a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,29 @@ +2012-12-13 Byungwoo Lee + + [EFL] Remove redundant pipe write to prevent pipe buffer full. + https://bugs.webkit.org/show_bug.cgi?id=101135 + + Reviewed by Gyuyoung Kim. + + To prevent a source of a deadlock, remove the redundant pipe write + in wakeUp() function. + + EFL uses ecore_pipe_write() to wake up main run loop, and the function + uses POSIX pipe write with O_NONBLOCK disabled. + With O_NONBLOCK disabled, when written data is more than PIPE_BUF, + pipe write will be blocked until it can be written. + + Currently, every wakeUp() function calls ecore_pipe_write() to invoke + wakeUpEvent() callback. And this can make pipe buffer full status + which is the one reason of the lockup problem described in Bug 99494. + + * platform/RunLoop.h: + (RunLoop): + * platform/efl/RunLoopEfl.cpp: + (WebCore::RunLoop::RunLoop): + (WebCore::RunLoop::wakeUpEvent): + (WebCore::RunLoop::wakeUp): + 2012-12-11 Viatcheslav Ostapenko Remove conversion to/from float and float division from ImageFrame::setRGBA diff --git a/Source/WebCore/platform/RunLoop.h b/Source/WebCore/platform/RunLoop.h index fbfb837..57a87d7 100644 --- a/Source/WebCore/platform/RunLoop.h +++ b/Source/WebCore/platform/RunLoop.h @@ -171,6 +171,9 @@ private: Mutex m_pipeLock; OwnPtr m_pipe; + Mutex m_wakeUpEventRequestedLock; + bool m_wakeUpEventRequested; + static void wakeUpEvent(void* data, void*, unsigned int); #endif }; diff --git a/Source/WebCore/platform/efl/RunLoopEfl.cpp b/Source/WebCore/platform/efl/RunLoopEfl.cpp index 8fd97dc..4406fdc 100644 --- a/Source/WebCore/platform/efl/RunLoopEfl.cpp +++ b/Source/WebCore/platform/efl/RunLoopEfl.cpp @@ -43,6 +43,7 @@ namespace WebCore { RunLoop::RunLoop() : m_initEfl(false) + , m_wakeUpEventRequested(false) { if (!ecore_init()) { LOG_ERROR("could not init ecore."); @@ -99,25 +100,41 @@ void RunLoop::stop() void RunLoop::wakeUpEvent(void* data, void*, unsigned int) { - static_cast(data)->performWork(); + RunLoop* loop = static_cast(data); + + { + MutexLocker locker(loop->m_wakeUpEventRequestedLock); + loop->m_wakeUpEventRequested = false; + } + + loop->performWork(); } void RunLoop::wakeUp() { - MutexLocker locker(m_pipeLock); -#if ENABLE(TIZEN_RUNLOOP_WAKEUP_ERROR_WORKAROUND) - Eina_Bool result = false; - while(1) { - result = ecore_pipe_write(m_pipe.get(), wakupEcorePipeMessage, ecorePipeMessageSize); - if (result) + { + MutexLocker locker(m_wakeUpEventRequestedLock); + if (m_wakeUpEventRequested) return; - - LOG_ERROR("Failed to write a wakupEcorePipeMessage\n"); - m_pipe = adoptPtr(ecore_pipe_add(wakeUpEvent, this)); // due to OwnPtr, ecore_pipe_del is called automatically. + m_wakeUpEventRequested = true; } + + { + MutexLocker locker(m_pipeLock); +#if ENABLE(TIZEN_RUNLOOP_WAKEUP_ERROR_WORKAROUND) + Eina_Bool result = false; + while(1) { + result = ecore_pipe_write(m_pipe.get(), wakupEcorePipeMessage, ecorePipeMessageSize); + if (result) + return; + + LOG_ERROR("Failed to write a wakupEcorePipeMessage\n"); + m_pipe = adoptPtr(ecore_pipe_add(wakeUpEvent, this)); // due to OwnPtr, ecore_pipe_del is called automatically. + } #else - ecore_pipe_write(m_pipe.get(), wakupEcorePipeMessage, ecorePipeMessageSize); + ecore_pipe_write(m_pipe.get(), wakupEcorePipeMessage, ecorePipeMessageSize); #endif + } } RunLoop::TimerBase::TimerBase(RunLoop*)