<?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>280073</bug_id>
          
          <creation_ts>2024-09-20 10:41:24 -0700</creation_ts>
          <short_desc>REGRESSION(283414@main): [WPE][GTK] File descriptor leak if process launch is canceled immediately</short_desc>
          <delta_ts>2024-09-24 08:18:06 -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>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=280061</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=280237</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="Michael Catanzaro">mcatanzaro</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2061880</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-09-20 10:41:24 -0700</bug_when>
    <thetext>Since 283414@main, if the ProcessLauncher is destroyed before received a reply from its pid socket, the server end of the socket is leaked. The bug is here in ProcessLauncherGLib.cpp&apos;s ProcessLauncher::launchProcess:

    m_socketMonitor.start(pidSocket.get(), G_IO_IN, RunLoop::main(), [protectedThis = Ref { *this }, this, pidSocket, serverSocket = WTFMove(webkitSocketPair.server)](GIOCondition condition) -&gt; gboolean {

That code moves ownership of the socket to the lambda function, without resource-acquisition-is-initialization semantics. If the socket monitor is destroyed before executing the callback, the socket is leaked. Using UnixFileDescriptor like we&apos;re supposed to would have prevented this, but I was overconfident because the code seemed simple.

See also: bug #280061</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062341</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-09-23 08:30:10 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/34089</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062550</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-09-23 17:05:06 -0700</bug_when>
    <thetext>Follow up: bug #280237</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062740</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-09-24 08:18:03 -0700</bug_when>
    <thetext>Committed 284159@main (7dd6aeafdd8e): &lt;https://commits.webkit.org/284159@main&gt;

Reviewed commits have been landed. Closing PR #34089 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>