Bug 210483 - [GLIB] Fix race condition in FileMonitor implementation
Summary: [GLIB] Fix race condition in FileMonitor implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk, InRadar
Depends on:
Blocks: 210184
  Show dependency treegraph
 
Reported: 2020-04-14 02:09 PDT by Carlos Garcia Campos
Modified: 2020-04-14 03:25 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.90 KB, patch)
2020-04-14 02:13 PDT, Carlos Garcia Campos
aperez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2020-04-14 02:09:15 PDT
This is causing flaky timeouts when running resource load statistics layout tests.

Thread 22 (Thread 0x7f89267fc700 (LWP 16578)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f89cf5c12ec in g_mutex_lock_slowpath (mutex=mutex@entry=0x7f89cf875f40 <g.inotify_lock_lock>) at ../glib/gthread-posix.c:1340
#2  0x00007f89cf5c1b52 in g_mutex_lock (mutex=mutex@entry=0x7f89cf875f40 <g.inotify_lock_lock>) at ../glib/gthread-posix.c:1364
#3  0x00007f89cf7e0060 in _ih_startup () at ../gio/inotify/inotify-helper.c:74
#4  0x00007f89cf7e0410 in g_inotify_file_monitor_start (local_monitor=<optimized out>, dirname=0x7f890c006590 "/tmp/wk-drt/ResourceLoadStatistics", basename=0x7f890c0065c0 "full_browsing_session_resourceLog.plist", filename=0x0, source=0x7f890c006440) at ../gio/inotify/ginotifyfilemonitor.c:61
#5  0x00007f89cf7d58ec in g_local_file_monitor_new_for_path (pathname=0x7f890c0047a0 "/tmp/wk-drt/ResourceLoadStatistics/full_browsing_session_resourceLog.plist", is_directory=0, flags=G_FILE_MONITOR_NONE, error=0x0) at ../gio/glocalfilemonitor.c:888
#6  0x00007f89cf70ca73 in g_file_monitor_file (file=0x7f890c002700, flags=G_FILE_MONITOR_NONE, cancellable=0x0, error=0x7f89267fb8e8) at ../gio/gfile.c:5483
#7  0x00007f89d3be8f14 in WebCore::FileMonitor::FileMonitor(WTF::String const&, WTF::Ref<WTF::WorkQueue, WTF::DumbPtrTraits<WTF::WorkQueue> >&&, WTF::Function<void (WebCore::FileMonitor::FileChangeType)>&&) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#8  0x00007f89d24345c6 in WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#9  0x00007f89d243c267 in WTF::Detail::CallableWrapper<WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(WebKit::NetworkSession&, WTF::String const&, WebKit::ShouldIncludeLocalhost, WebCore::ResourceLoadStatistics::IsEphemeral)::{lambda()#1}, void>::call() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#10 0x00007f89cedcaa19 in WTF::RunLoop::performWork() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#11 0x00007f89cee293f9 in WTF::RunLoop::RunLoop()::{lambda(void*)#1}::_FUN(void*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#12 0x00007f89cf5779fe in g_main_dispatch (context=0x7f890c000b60) at ../glib/gmain.c:3185
#13 g_main_context_dispatch (context=context@entry=0x7f890c000b60) at ../glib/gmain.c:3850
#14 0x00007f89cf577d80 in g_main_context_iterate (context=0x7f890c000b60, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3923
#15 0x00007f89cf578053 in g_main_loop_run (loop=0x7f890c003e60) at ../glib/gmain.c:4117
#16 0x00007f89cee29ec0 in WTF::RunLoop::run() () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#17 0x00007f89cedcc254 in WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#18 0x00007f89cee2b289 in WTF::wtfThreadEntryPoint(void*) () from /home/cgarcia/src/git/gnome/WebKit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#19 0x00007f89cd595f27 in start_thread (arg=<optimized out>) at pthread_create.c:479
#20 0x00007f89d03ac2ef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f8986ffe700 (LWP 16472)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f89cf5c12ec in g_mutex_lock_slowpath (mutex=mutex@entry=0x7f89cf875f40 <g.inotify_lock_lock>) at ../glib/gthread-posix.c:1340
#2  0x00007f89cf5c1b52 in g_mutex_lock (mutex=mutex@entry=0x7f89cf875f40 <g.inotify_lock_lock>) at ../glib/gthread-posix.c:1364
#3  0x00007f89cf7e0140 in _ih_sub_cancel (sub=0x7f89580129c0) at ../gio/inotify/inotify-helper.c:121
#4  0x00007f89cf7e03ba in g_inotify_file_monitor_cancel (monitor=0x7f8970006240) at ../gio/inotify/ginotifyfilemonitor.c:75
#5  0x00007f89cf717727 in g_file_monitor_cancel (monitor=0x7f8970006240) at ../gio/gfilemonitor.c:241
#6  g_file_monitor_cancel (monitor=0x7f8970006240) at ../gio/gfilemonitor.c:235
#7  0x00007f89cf71779c in g_file_monitor_dispose (object=0x7f8970006240) at ../gio/gfilemonitor.c:123
#8  0x00007f89cf7d5443 in g_local_file_monitor_dispose (object=0x7f8970006240) at ../gio/glocalfilemonitor.c:814
#9  0x00007f89cf665cb3 in g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3440
#10 g_object_unref (_object=0x7f8970006240) at ../gobject/gobject.c:3370
#11 0x00007f89cf7d4ee3 in g_file_monitor_source_handle_event (fms=0x7f8958012830, event_type=event_type@entry=G_FILE_MONITOR_EVENT_DELETED, child=<optimized out>, rename_to=rename_to@entry=0x0, other=<optimized out>, other@entry=0x0, event_time=<optimized out>) at ../gio/glocalfilemonitor.c:455
#12 0x00007f89cf7dfcc8 in ih_event_callback (event=0x7f897c0045b0, sub=0x7f89580129c0, file_event=<optimized out>) at ../gio/inotify/inotify-helper.c:206
#13 0x00007f89cf7df29c in ip_event_dispatch (dir_list=dir_list@entry=0x7f894c0022a0, file_list=0x0, event=event@entry=0x7f897c0045b0) at ../gio/inotify/inotify-path.c:492
#14 0x00007f89cf7df45e in ip_event_dispatch (event=0x7f897c0045b0, file_list=<optimized out>, dir_list=0x7f894c0022a0) at ../gio/inotify/inotify-path.c:547
#15 ip_event_callback (event=0x7f897c0045b0) at ../gio/inotify/inotify-path.c:547
#16 ip_event_callback (event=event@entry=0x7f897c0045b0) at ../gio/inotify/inotify-path.c:529
#17 0x00007f89cf7de7e9 in ik_source_dispatch (source=0x5604185b8990, func=0x7f89cf7df3a0 <ip_event_callback>, user_data=<optimized out>) at ../gio/inotify/inotify-kernel.c:327
#18 0x00007f89cf5779fe in g_main_dispatch (context=0x560418591d80) at ../glib/gmain.c:3185
#19 g_main_context_dispatch (context=context@entry=0x560418591d80) at ../glib/gmain.c:3850
#20 0x00007f89cf577d80 in g_main_context_iterate (context=context@entry=0x560418591d80, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3923
#21 0x00007f89cf577e0f in g_main_context_iteration (context=0x560418591d80, may_block=may_block@entry=1) at ../glib/gmain.c:3984
#22 0x00007f89cf577e61 in glib_worker_main (data=<optimized out>) at ../glib/gmain.c:5870
#23 0x00007f89cf59fb7d in g_thread_proxy (data=0x560418592000) at ../glib/gthread.c:805
#24 0x00007f89cd595f27 in start_thread (arg=<optimized out>) at pthread_create.c:479
#25 0x00007f89d03ac2ef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Comment 1 Carlos Garcia Campos 2020-04-14 02:13:12 PDT
Created attachment 396390 [details]
Patch
Comment 2 Carlos Garcia Campos 2020-04-14 03:24:58 PDT
Committed r260067: <https://trac.webkit.org/changeset/260067>
Comment 3 Radar WebKit Bug Importer 2020-04-14 03:25:14 PDT
<rdar://problem/61763955>