<?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>245576</bug_id>
          
          <creation_ts>2022-09-23 07:58:00 -0700</creation_ts>
          <short_desc>Do not try to preconnect on link click when link preconnect setting is disabled</short_desc>
          <delta_ts>2022-09-30 02:22:18 -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>WebCore Misc.</component>
          <version>WebKit Nightly Build</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=244026</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</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="Carlos Garcia Campos">cgarcia</assigned_to>
          <cc>achristensen</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cdumez</cc>
    
    <cc>cgarcia</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1900639</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-09-23 07:58:00 -0700</bug_when>
    <thetext>Splitting this from bug #244026. We currently have a network process crash when calling NetworkConnectionToWebProcess::preconnectTo. We should look closer to decide what to do here. Although fixing WTFReleaseLogStackTrace would avoid the crash, I think we should go further and ensure that ResourceError::internalError does not get called. Note this only happens when ENABLE_SERVER_PRECONNECT is disabled, so the crash is specific to libsoup 2 builds only. Probably we should drop the request in NetworkConnectionToWebProcess::preconnectTo with some different error, but another option would be to find everywhere that calls it and guard it behind ENABLE_SERVER_PRECONNECT.

Backtrace:

/usr/lib/aarch64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000ffff7cfdfaa0 in __GI_abort () at abort.c:79
#2  0x0000ffff7fa8ac50 in WTFCrashWithInfo(int, char const*, char const*, int) () at WTF/Headers/wtf/Assertions.h:741
#3  0x0000ffff80a2d5a8 in captureStackTrace () at ../Source/WTF/wtf/StackTrace.cpp:79
#4  0x0000ffff80a08ea0 in WTFReleaseLogStackTrace () at ../Source/WTF/wtf/Assertions.cpp:592
#5  0x0000ffff83c06550 in internalError () at ../Source/WebCore/platform/network/ResourceErrorBase.cpp:97
#6  0x0000ffff820e8d1c in preconnectTo () at ../Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:735
#7  0x0000ffff81fc62f4 in callMemberFunctionImpl&lt;WebKit::NetworkConnectionToWebProcess, void (WebKit::NetworkConnectionToWebProcess::*)(std::optional&lt;WTF::ObjectIdentifier&lt;WebCore::ResourceLoader&gt; &gt;, WebKit::NetworkResourceLoadParameters&amp;&amp;), std::tuple&lt;std::optional&lt;WTF::ObjectIdentifier&lt;WebCore::ResourceLoader&gt; &gt;, WebKit::NetworkResourceLoadParameters&gt;, 0, 1&gt; () at ../Source/WebKit/Platform/IPC/HandleMessage.h:125
#8  callMemberFunction&lt;WebKit::NetworkConnectionToWebProcess, void (WebKit::NetworkConnectionToWebProcess::*)(std::optional&lt;WTF::ObjectIdentifier&lt;WebCore::ResourceLoader&gt; &gt;, WebKit::NetworkResourceLoadParameters&amp;&amp;), std::tuple&lt;std::optional&lt;WTF::ObjectIdentifier&lt;WebCore::ResourceLoader&gt; &gt;, WebKit::NetworkResourceLoadParameters&gt;, std::integer_sequence&lt;unsigned long, 0, 1&gt; &gt; () at ../Source/WebKit/Platform/IPC/HandleMessage.h:131
#9  handleMessage&lt;Messages::NetworkConnectionToWebProcess::PreconnectTo, WebKit::NetworkConnectionToWebProcess, void (WebKit::NetworkConnectionToWebProcess::*)(std::optional&lt;WTF::ObjectIdentifier&lt;WebCore::ResourceLoader&gt; &gt;, WebKit::NetworkResourceLoadParameters&amp;&amp;)&gt; () at ../Source/WebKit/Platform/IPC/HandleMessage.h:196
#10 didReceiveNetworkConnectionToWebProcessMessage () at DerivedSources/WebKit/NetworkConnectionToWebProcessMessageReceiver.cpp:479
#11 0x0000ffff822543d0 in dispatchMessage () at ../Source/WebKit/Platform/IPC/Connection.cpp:1134
#12 0x0000ffff82254768 in dispatchOneIncomingMessage () at ../Source/WebKit/Platform/IPC/Connection.cpp:1203
#13 0x0000ffff80a2bf40 in operator() () at ../Source/WTF/wtf/Function.h:82
#14 performWork () at ../Source/WTF/wtf/RunLoop.cpp:133
#15 0x0000ffff80a85190 in operator() () at ../Source/WTF/wtf/glib/RunLoopGLib.cpp:80
#16 __invoke () at ../Source/WTF/wtf/glib/RunLoopGLib.cpp:79
#17 0x0000ffff80a84524 in operator() () at ../Source/WTF/wtf/glib/RunLoopGLib.cpp:53
#18 __invoke () at ../Source/WTF/wtf/glib/RunLoopGLib.cpp:45
#19 0x0000ffff7d551ab4 in g_main_context_dispatch () from /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#20 0x0000ffff7d551e5c in ?? () from /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#21 0x0000ffff7d5521b0 in g_main_loop_run () from /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#22 0x0000ffff80a84b20 in run () at ../Source/WTF/wtf/glib/RunLoopGLib.cpp:108
#23 0x0000ffff822280d8 in run () at ../Source/WebKit/Shared/AuxiliaryProcessMain.h:70
#24 AuxiliaryProcessMain&lt;WebKit::NetworkProcessMainSoup&gt; () at ../Source/WebKit/Shared/AuxiliaryProcessMain.h:96
#25 0x0000ffff7cfdfe18 in __libc_start_main (main=0x400878 &lt;__wrap_main&gt;, argc=3, argv=0xfffff1c90058, init=&lt;optimized out&gt;, fini=&lt;optimized out&gt;,
    rtld_fini=&lt;optimized out&gt;, stack_end=&lt;optimized out&gt;) at ../csu/libc-start.c:308
    #26 0x0000000000400874 in _start ()

Please see bug #244026 for more context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901055</commentid>
    <comment_count>1</comment_count>
      <attachid>462600</attachid>
    <who name="Sebastian Krzyszkowiak">webkit</who>
    <bug_when>2022-09-25 14:58:38 -0700</bug_when>
    <thetext>Created attachment 462600
Add ENABLE(SERVER_PRECONNECT) guards

Not sure if those are all instances that need to be guarded, but at least those two seem to make the browser appear usable again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901455</commentid>
    <comment_count>2</comment_count>
      <attachid>462600</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2022-09-27 04:22:13 -0700</bug_when>
    <thetext>Comment on attachment 462600
Add ENABLE(SERVER_PRECONNECT) guards

View in context: https://bugs.webkit.org/attachment.cgi?id=462600&amp;action=review

&gt; Source/WebCore/html/HTMLAnchorElement.cpp:542
&gt; +#if !ENABLE(SERVER_PRECONNECT)
&gt; +    return;
&gt; +#endif

It would be better to add the guard around the block below. But I wonder if it would be better to check linkPreconnectEnabled in settings instead. Alex? Chris?

&gt; Source/WebCore/loader/LinkLoader.cpp:214
&gt; +#if !ENABLE(SERVER_PRECONNECT)
&gt; +    return;
&gt; +#endif

Are you sure you need this one? If server preconnect is disabled then params.relAttribute.isLinkPreconnect should be false below, so it will return early in any case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901536</commentid>
    <comment_count>3</comment_count>
    <who name="Sebastian Krzyszkowiak">webkit</who>
    <bug_when>2022-09-27 09:00:03 -0700</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #2)
&gt; Are you sure you need this one?

No. Consider my patch just a step in debugging rather than a fix proposal. I know nothing about WebKit&apos;s codebase and my setup takes a few hours to build a working WK package, so I simply went with testing a minimal change that seemed likely to avoid the crash, and reported my findings here :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901602</commentid>
    <comment_count>4</comment_count>
      <attachid>462600</attachid>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2022-09-27 13:39:05 -0700</bug_when>
    <thetext>Comment on attachment 462600
Add ENABLE(SERVER_PRECONNECT) guards

View in context: https://bugs.webkit.org/attachment.cgi?id=462600&amp;action=review

&gt;&gt; Source/WebCore/html/HTMLAnchorElement.cpp:542
&gt;&gt; +#endif
&gt; 
&gt; It would be better to add the guard around the block below. But I wonder if it would be better to check linkPreconnectEnabled in settings instead. Alex? Chris?

Yeah, this isn&apos;t great.  It adds a bunch of unreachable code when SERVER_PRECONNECT is disabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901744</commentid>
    <comment_count>5</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2022-09-28 05:10:39 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/4790</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902295</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-09-30 02:21:25 -0700</bug_when>
    <thetext>Committed 255024@main (49f6854f09b5): &lt;https://commits.webkit.org/255024@main&gt;

Reviewed commits have been landed. Closing PR #4790 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902296</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-30 02:22:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/100603273&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>462600</attachid>
            <date>2022-09-25 14:58:38 -0700</date>
            <delta_ts>2022-09-25 14:58:38 -0700</delta_ts>
            <desc>Add ENABLE(SERVER_PRECONNECT) guards</desc>
            <filename>0009-patch2.patch</filename>
            <type>text/plain</type>
            <size>1679</size>
            <attacher name="Sebastian Krzyszkowiak">webkit</attacher>
            
              <data encoding="base64">RnJvbTogU2ViYXN0aWFuIEtyenlzemtvd2lhayA8c2ViYXN0aWFuLmtyenlzemtvd2lha0BwdXJp
LnNtPgpEYXRlOiBTYXQsIDI0IFNlcCAyMDIyIDA2OjE3OjEyICswMjAwClN1YmplY3Q6IHBhdGNo
MgoKLS0tCiBTb3VyY2UvV2ViQ29yZS9odG1sL0hUTUxBbmNob3JFbGVtZW50LmNwcCB8IDQgKysr
KwogU291cmNlL1dlYkNvcmUvbG9hZGVyL0xpbmtMb2FkZXIuY3BwICAgICAgfCAzICsrKwogMiBm
aWxlcyBjaGFuZ2VkLCA3IGluc2VydGlvbnMoKykKCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29y
ZS9odG1sL0hUTUxBbmNob3JFbGVtZW50LmNwcCBiL1NvdXJjZS9XZWJDb3JlL2h0bWwvSFRNTEFu
Y2hvckVsZW1lbnQuY3BwCmluZGV4IGMzMGRjNmYuLjdmOGYxZjUgMTAwNjQ0Ci0tLSBhL1NvdXJj
ZS9XZWJDb3JlL2h0bWwvSFRNTEFuY2hvckVsZW1lbnQuY3BwCisrKyBiL1NvdXJjZS9XZWJDb3Jl
L2h0bWwvSFRNTEFuY2hvckVsZW1lbnQuY3BwCkBAIC01MzcsNiArNTM3LDEwIEBAIHZvaWQgSFRN
TEFuY2hvckVsZW1lbnQ6OmhhbmRsZUNsaWNrKEV2ZW50JiBldmVudCkKIAogICAgIHNlbmRQaW5n
cyhjb21wbGV0ZWRVUkwpOwogCisjaWYgIUVOQUJMRShTRVJWRVJfUFJFQ09OTkVDVCkKKyAgICBy
ZXR1cm47CisjZW5kaWYKKwogICAgIC8vIFByZ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