<?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>265746</bug_id>
          
          <creation_ts>2023-12-03 00:36:00 -0800</creation_ts>
          <short_desc>[enhancement] use flatpak portal directly rather than using the flatpak-spawn executable</short_desc>
          <delta_ts>2024-08-25 00:36:35 -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>Unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <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>two</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>philn</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1996530</commentid>
    <comment_count>0</comment_count>
    <who name="">two</who>
    <bug_when>2023-12-03 00:36:00 -0800</bug_when>
    <thetext>flatpaked browsers have process trees looking like this:
```
| epiphany
|| flatpak-spawn
|| flatpak-spawn
|| ...
```

afaik all those flatpak-spawn are doing are telling a portal to spawn a process in a different sandbox then waiting for a d-bus notification for its end. using the flatpak-spawn executable probably adds up to the tab startup time, and can fail due to bugs such as https://github.com/flatpak/flatpak/issues/5398, making epiphany stuck in an infinite loop. this would probably be better done in the browser process.

but that would probably be difficult to implement, since it&apos;s async and also the processes are in a different PID namespace, so they have to be killed via the portal too</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2054985</commentid>
    <comment_count>1</comment_count>
    <who name="">two</who>
    <bug_when>2024-08-23 13:32:05 -0700</bug_when>
    <thetext>(In reply to two from comment #0)
&gt; but that would probably be difficult to implement, since it&apos;s async and also
&gt; the processes are in a different PID namespace, so they have to be killed
&gt; via the portal too

*it uses --share-pids already to have a common pidns, so not as much as i thought needs to be changed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2055120</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-08-24 06:21:39 -0700</bug_when>
    <thetext>(In reply to two from comment #1)
&gt; *it uses --share-pids already to have a common pidns, so not as much as i
&gt; thought needs to be changed

No, there is no common pid namespace.

It does use --expose-pids, but that is different. There&apos;s still separate pid namespaces.

Ultimately flatpak-spawn is just a convenience wrapper around the portal API. If we stop using it, we&apos;re probably just going to have to wind up reimplementing whatever else it is doing, so there should be a good reason for doing so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2055192</commentid>
    <comment_count>3</comment_count>
    <who name="">two</who>
    <bug_when>2024-08-25 00:36:35 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #2)
&gt; so there should be a good reason
&gt; for doing so.

most importantly to work around the &quot;Invalid byte sequence in conversion input&quot; bug... but now i looked at flaptak-spawn&apos;s code again, and i think it might also be fixed by passing /proc/self/environ to --env-fd instead of passing each variable to --env?

but also to shorten the current micro freeze when spawning a new web process by not having to wait for pidSocket

(also because less processes)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>