From: Jihye Kang Date: Tue, 9 Apr 2013 15:57:54 +0000 (+0900) Subject: Fix lockup issue occurred while stress test for filesystem X-Git-Tag: 2.1_release~123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f1de73401b443e4cf2065c2f19a243c8fe5364a;p=platform%2Fframework%2Fweb%2Fwebkit-efl.git Fix lockup issue occurred while stress test for filesystem [Title] Fix lockup issue occurred while stress test for filesystem [Issue#] N/A [Problem] Lockup occurs while calling writer.write() stressfully [Cause] ecore_pipe_write() is blocked because PIPE_BUF is full with O_NONBLOCK disabled for waiting the pipe is ready to write. But pipe cannot be consumed because main thread is blocked because ecore_pipe_write() is blocked. [Solution] dispatchFunctionsFromMainThread(), called by registered Ecore_Pipe_Cb for the pipe, consume functionQueue as many as possible until maxRunLoopSuspensionTime is reached. It means ecore_pipe_write() does not needed to be called when waiting for pipe is read. - write:read does not need to be 1:1 call. So add flag for check whether scheduled request waiting for read exists or not. Change-Id: I58a2724c1eb33c1565a88844cc87e33ee576a6d4 --- diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index a661e20..837e27e 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -797,6 +797,8 @@ com) : Patch to do not adjust cover rect as fixed pixel size*/ #define ENABLE_TIZEN_GET_EXTERNAL_RESOURCES_IN_MHTML_FROM_NETWORK 1 /* Praveen(praveen.ks@samsung.com) : Allow external resources in MHTML file to be fetched from network rather than failing them */ +#define ENABLE_TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST 1 /* Jihye Kang(jye.kang@samsung.com) : Fix lockup while doing stress test for filewriter */ + #endif /* OS(TIZEN) */ /* ==== OS() - underlying operating system; only to be used for mandated low-level services like diff --git a/Source/WTF/wtf/efl/MainThreadEfl.cpp b/Source/WTF/wtf/efl/MainThreadEfl.cpp index 7ae0bc4..600686c 100644 --- a/Source/WTF/wtf/efl/MainThreadEfl.cpp +++ b/Source/WTF/wtf/efl/MainThreadEfl.cpp @@ -34,6 +34,7 @@ #include "config.h" #include "MainThread.h" +#include "Threading.h" #include #include #include @@ -47,8 +48,28 @@ static OwnPtr& pipeObject() return pipeObject; } +#if ENABLE(TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST) +static Mutex& scheduleRequestedMutex() +{ + DEFINE_STATIC_LOCAL(Mutex, staticMutex, ()); + return staticMutex; +} + +static bool& scheduleRequested() +{ + DEFINE_STATIC_LOCAL(bool, staticScheduleRequested, ()); + return staticScheduleRequested; +} +#endif + static void monitorDispatchFunctions(void*, void*, unsigned int) { +#if ENABLE(TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST) + { + MutexLocker locker(scheduleRequestedMutex()); + scheduleRequested() = false; + } +#endif dispatchFunctionsFromMainThread(); } @@ -65,7 +86,25 @@ void initializeMainThreadPlatform() void scheduleDispatchFunctionsOnMainThread() { +#if ENABLE(TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST) + { + MutexLocker locker(scheduleRequestedMutex()); + if (scheduleRequested()) + return; + scheduleRequested() = true; + } + + Eina_Bool result = false; + while (!result) { + result = ecore_pipe_write(pipeObject().get(), "", 0); + if (!result) { + TIZEN_LOGE("Failed to write shceduleDispatchFunction pipe message"); + pipeObject() = adoptPtr(ecore_pipe_add(monitorDispatchFunctions, 0)); + } + } +#else ecore_pipe_write(pipeObject().get(), "", 0); +#endif } }