<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>280631</bug_id>
          
          <creation_ts>2024-09-30 12:52:43 -0700</creation_ts>
          <short_desc>[WPE][GTK] Add process monitor process and reenable web process suspend/resume</short_desc>
          <delta_ts>2026-06-09 13:37:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=280014</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>pgriffis</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2064312</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-09-30 12:52:43 -0700</bug_when>
    <thetext>In bug #280014 I disabled web process suspend/resume because it doesn&apos;t work robustly if the UI process crashes or is terminated uncleanly (e.g. using Ctrl+C).

To bring this back, we need a new helper process to monitor all other WebKit auxiliary processes, which should be unlikely to crash and robust to SIGINT.

The problem is that we currently rely on the web process to notice that its IPC socket to the UI process is closed, upon which it will quit. But if we have stopped the web process with SIGSTOP, then it&apos;s impossible for it to notice this condition, and it will just remain stopped forever.

(Note that prior to 280061@main, bubblewrap sandbox would manage subprocesses, avoiding this problem. Bringing that back might make sense, if we could find some alternate solution for unsandboxed WebKit and flatpak sandbox.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2218667</commentid>
    <comment_count>1</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2026-06-08 16:50:01 -0700</bug_when>
    <thetext>I don&apos;t know that this directly fixes what you want, but I&apos;ve played around with using cgroups to &quot;freeze&quot; processes like on Apple platforms: https://github.com/TingPing/WebKit/tree/pgriffis/process-freezing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2218704</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2026-06-08 18:21:49 -0700</bug_when>
    <thetext>I mean: my complaint here is that suspended processes get leaked forever. As long as your implementation does not have that bug, then we should be good. I suggested a process monitor process because only I couldn&apos;t think of any other way to make this work. I didn&apos;t know you could do this using cgroups.

Currently uresourced is responsible for putting web processes into cgroups, so it probably needs to be updated to accommodate your changes here. Probably it should just stop touching web processes if WebKit is going to do that itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2219030</commentid>
    <comment_count>3</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2026-06-09 13:01:40 -0700</bug_when>
    <thetext>OK, regarding the process leaking I think the same issue would apply here.

How Apple handles it is that it&apos;s an external process managing the suspension. Which I guess is what we would need to do as well...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2219037</commentid>
    <comment_count>4</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2026-06-09 13:10:49 -0700</bug_when>
    <thetext>I believe this can be handled by `systemd`.

1. A TransientUnit is made for the UIProcess
2. When making a TransientUnit for the child processes, set `BindsTo=$parent`

So when the UIProcess shuts down unexpectedly, all of the units bound to it are killed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2219040</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2026-06-09 13:16:37 -0700</bug_when>
    <thetext>Sure, but then you sabotage the watchdog thread to detect an out of control web process, which has been quite helpful for debugging hangs (especially in multimedia code). See again: 280061@main.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2219041</commentid>
    <comment_count>6</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2026-06-09 13:24:07 -0700</bug_when>
    <thetext>I&apos;m not familiar with the watchdog but we can ask the child unit to cleanly stop or abandon it to remove it from systemd tracking entirely during shutdown.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2219046</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2026-06-09 13:37:05 -0700</bug_when>
    <thetext>The watchdog thread is simple: crashAfter10Seconds in Source/WebKit/WebProcess/WebProcess.cpp.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>