Branch: refs/heads/webkitglib/2.52
  Home:   https://github.com/WebKit/WebKit
  Commit: 1815b508d98d7c905e3368477afdd1008e9f36f4
      
https://github.com/WebKit/WebKit/commit/1815b508d98d7c905e3368477afdd1008e9f36f4
  Author: Simon Pena <[email protected]>
  Date:   2026-04-10 (Fri, 10 Apr 2026)

  Changed paths:
    M Source/WTF/wtf/linux/RealTimeThreads.cpp
    M Source/WTF/wtf/linux/RealTimeThreads.h

  Log Message:
  -----------
  Cherry-pick 310907@main (0831c81f23e3). 
https://bugs.webkit.org/show_bug.cgi?id=276312

    [WPE][GTK] Internal error fired from WebLoaderStrategy.cpp(559) : 
internallyFailedLoadTimerFired
    https://bugs.webkit.org/show_bug.cgi?id=276312

    Reviewed by Adrian Perez de Castro.

    It seems that under certain circumstances, NetworkProcess real-time
    threads (promoted by RealtimeKit) will exceed their maximum 200ms hard
    limit (rlim_max), getting killed by the kernel.

    Although the code has provisions in place to demote the threads back
    from real time, the fact the soft limit was set at the same value as the
    hard limit meant it would never have a chance to run.

    This commit adds two changes:
     - It sets the real time soft limit to 0.8 of the hard one, giving a
       chance to the SIGXCPU handler to run before the hard limit triggers a
       kill.
     - It makes the SIGXCPU signal handler async-signal-safe. The previous
       one needed to acquire a mutex and called sched_setscheduler, the
       current one uses eventfd.

    The new implementation uses the handler installed by sigaction to write
    to the event fd. This is bridged to the GLib main loop by g_unix_fd_add,
    so that the callback can be queued and run safely, demoting all threads.

    As the signal handler is installed, we query if a previous handler was
    previously defined -- as done in ThreadingPOSIX --, logging it
    unconditionally.

    This bug can be reproduced consistently on debug builds under heavy load
    (using e.g. stress-ng) without this fix. Commenting out setrlimit means
    the process attempts to set an unlimited max, which RealtimeKit rejects:
    in that case, the NetworkProcess runs normally and is not killed. After
    this fix is applied, the demotion runs and NetworkProcess can survive.

    * Source/WTF/wtf/linux/RealTimeThreads.cpp:
    (WTF::RealTimeThreads::RealTimeThreads):
    (WTF::RealTimeThreads::demoteThreadFromRealTime):
    (WTF::sigxcpuHandler):
    (WTF::RealTimeThreads::setupSignalHandler):
    (WTF::RealTimeThreads::signalCallback):
    (WTF::RealTimeThreads::realTimeKitMakeThreadRealTime):
    * Source/WTF/wtf/linux/RealTimeThreads.h:

    Canonical link: https://commits.webkit.org/310907@main

Canonical link: https://commits.webkit.org/305877.406@webkitglib/2.52



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to