<?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>222998</bug_id>
          
          <creation_ts>2021-03-09 14:54:46 -0800</creation_ts>
          <short_desc>REGRESSION: [BigSur] ASSERT NOT REACHED in WebCore::ResourceLoadPriority WebCore::toResourceLoadPriority</short_desc>
          <delta_ts>2021-03-09 20:30:46 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=222934</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="Ryan Haddad">ryanhaddad</reporter>
          <assigned_to name="Ben Nham">nham</assigned_to>
          <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>jenner</cc>
    
    <cc>nham</cc>
    
    <cc>webkit-bot-watchers-bugzilla</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1737783</commentid>
    <comment_count>0</comment_count>
    <who name="Ryan Haddad">ryanhaddad</who>
    <bug_when>2021-03-09 14:54:46 -0800</bug_when>
    <thetext>Seeing the following assertion failure on Big Sur Debug bots, causing tests to exit early: 

SHOULD NEVER BE REACHED
/Volumes/Data/worker/bigsur-debug/build/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h(62) : WebCore::ResourceLoadPriority WebCore::toResourceLoadPriority(CFURLRequestPriority)
1   0x142581769 WTFCrash
2   0x12602143b WTFCrashWithInfo(int, char const*, char const*, int)
3   0x128207fca WebCore::toResourceLoadPriority(long)
4   0x12820788b WebCore::ResourceRequest::doUpdateResourceRequest()
5   0x12a7c2e67 WebCore::ResourceRequestBase::updateResourceRequest(WebCore::HTTPBodyUpdatePolicy) const
6   0x12a7c2a74 WebCore::ResourceRequestBase::setPriority(WebCore::ResourceLoadPriority)
7   0x12b51da8d WebCore::WebCoreAVFResourceLoader::startLoading()
8   0x126423fee WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest*)
9   0x12646e1c0 -[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]::$_15::operator()()::&apos;lambda&apos;()::operator()() const
10  0x12646e06e WTF::Detail::CallableWrapper&lt;-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]::$_15::operator()()::&apos;lambda&apos;(), void&gt;::call()
11  0x126036422 WTF::Function&lt;void ()&gt;::operator()() const
12  0x1263f1765 WebCore::GenericTaskQueue&lt;WebCore::Timer&gt;::enqueueTask(WTF::Function&lt;void ()&gt;&amp;&amp;)::&apos;lambda&apos;()::operator()() const
13  0x1263f159e WTF::Detail::CallableWrapper&lt;WebCore::GenericTaskQueue&lt;WebCore::Timer&gt;::enqueueTask(WTF::Function&lt;void ()&gt;&amp;&amp;)::&apos;lambda&apos;(), void&gt;::call()
14  0x126036422 WTF::Function&lt;void ()&gt;::operator()() const
15  0x12a1fc82f WebCore::TaskDispatcher&lt;WebCore::Timer&gt;::dispatchOneTask()
16  0x12a1fc505 WebCore::TaskDispatcher&lt;WebCore::Timer&gt;::sharedTimerFired()
17  0x12a203e51 WebCore::TaskDispatcher&lt;WebCore::Timer&gt;::sharedTimer()::$_2::operator()() const
18  0x12a203e0e WTF::Detail::CallableWrapper&lt;WebCore::TaskDispatcher&lt;WebCore::Timer&gt;::sharedTimer()::$_2, void&gt;::call()
19  0x126036422 WTF::Function&lt;void ()&gt;::operator()() const
20  0x12607974e WebCore::Timer::fired()
21  0x12a25ffa4 WebCore::ThreadTimers::sharedTimerFiredInternal()
22  0x12a26a481 WebCore::ThreadTimers::setSharedTimer(WebCore::SharedTimer*)::$_0::operator()() const
23  0x12a26a42e WTF::Detail::CallableWrapper&lt;WebCore::ThreadTimers::setSharedTimer(WebCore::SharedTimer*)::$_0, void&gt;::call()
24  0x126036422 WTF::Function&lt;void ()&gt;::operator()() const
25  0x12a217a5b WebCore::MainThreadSharedTimer::fired()
26  0x12a2e8176 WebCore::timerFired(__CFRunLoopTimer*, void*)
27  0x7fff2047990d __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
28  0x7fff204793e8 __CFRunLoopDoTimer
29  0x7fff20478f42 __CFRunLoopDoTimers
30  0x7fff2045f57f __CFRunLoopRun
31  0x7fff2045e6ce CFRunLoopRunSpecific

https://build.webkit.org/results/Apple-BigSur-Debug-WK2-Tests/r274171%20(608)/results.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737784</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-09 14:54:55 -0800</bug_when>
    <thetext>&lt;rdar://problem/75236575&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737786</commentid>
    <comment_count>2</comment_count>
    <who name="Ryan Haddad">ryanhaddad</who>
    <bug_when>2021-03-09 14:56:28 -0800</bug_when>
    <thetext>This assert was added with https://trac.webkit.org/changeset/274161/webkit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737796</commentid>
    <comment_count>3</comment_count>
      <attachid>422766</attachid>
    <who name="Ben Nham">nham</who>
    <bug_when>2021-03-09 15:22:07 -0800</bug_when>
    <thetext>Created attachment 422766
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737801</commentid>
    <comment_count>4</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2021-03-09 15:24:46 -0800</bug_when>
    <thetext>Committed r274180 (235099@main): &lt;https://commits.webkit.org/235099@main&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737845</commentid>
    <comment_count>5</comment_count>
    <who name="Ryan Haddad">ryanhaddad</who>
    <bug_when>2021-03-09 16:28:23 -0800</bug_when>
    <thetext>*** Bug 223003 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737846</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-09 16:29:06 -0800</bug_when>
    <thetext>(In reply to Ben Nham from comment #4)
&gt; Committed r274180 (235099@main): &lt;https://commits.webkit.org/235099@main&gt;

Is VeryLow the priority we really want when we don&apos;t have a priority set?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737894</commentid>
    <comment_count>7</comment_count>
      <attachid>422766</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-09 18:56:04 -0800</bug_when>
    <thetext>Comment on attachment 422766
Patch

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

&gt; Source/WebCore/platform/network/cf/ResourceRequestCFNet.h:53
&gt;          return ResourceLoadPriority::VeryLow;

Is it OK correct to translate this -1 into VeryLow? Why not Medium? I don’t understand the repercussions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737896</commentid>
    <comment_count>8</comment_count>
      <attachid>422766</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-09 18:56:05 -0800</bug_when>
    <thetext>Comment on attachment 422766
Patch

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

&gt; Source/WebCore/platform/network/cf/ResourceRequestCFNet.h:53
&gt;          return ResourceLoadPriority::VeryLow;

Is it OK correct to translate this -1 into VeryLow? Why not Medium? I don’t understand the repercussions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737897</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-09 18:57:49 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #8)
&gt; Comment on attachment 422766 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=422766&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/platform/network/cf/ResourceRequestCFNet.h:53
&gt; &gt;          return ResourceLoadPriority::VeryLow;
&gt; 
&gt; Is it OK correct to translate this -1 into VeryLow? Why not Medium? I don’t
&gt; understand the repercussions.

Ahah that’s what I asked as well :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737905</commentid>
    <comment_count>10</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2021-03-09 19:46:06 -0800</bug_when>
    <thetext>(In reply to Darin Adler from comment #8)
&gt; Comment on attachment 422766 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=422766&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/platform/network/cf/ResourceRequestCFNet.h:53
&gt; &gt;          return ResourceLoadPriority::VeryLow;
&gt; 
&gt; Is it OK correct to translate this -1 into VeryLow? Why not Medium? I don’t
&gt; understand the repercussions.

(In reply to Chris Dumez from comment #9)
&gt; (In reply to Darin Adler from comment #8)
&gt; &gt; Comment on attachment 422766 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=422766&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/platform/network/cf/ResourceRequestCFNet.h:53
&gt; &gt; &gt;          return ResourceLoadPriority::VeryLow;
&gt; &gt; 
&gt; &gt; Is it OK correct to translate this -1 into VeryLow? Why not Medium? I don’t
&gt; &gt; understand the repercussions.
&gt; 
&gt; Ahah that’s what I asked as well :)

From a regression point of view, mapping -1 to VeryLow is fine since that is exactly what we were doing before:

https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h?rev=274160#L52

and the overall mapping is now exactly the same as it was before I introduced the FIXME in r252431:

https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h?rev=252430#L46

As for what the proper default request priority is, I&apos;m not really sure. It probably should be ResourceLoadPriority::Low based on the fact that this is the default used in both CachedResource::defaultPriorityForResourceType and ResourceRequestBase::m_priority. In practice I don&apos;t think it would make any perf difference since the call sites I looked at all set an explicit priority anyway. But I can make a separate cleanup patch tomorrow that adds a ResourceLoadPriority::Default and return that when the CF request priority is unset.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1737915</commentid>
    <comment_count>11</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2021-03-09 20:30:46 -0800</bug_when>
    <thetext>Now that I think about it, the existing mapping of CFURLRequestPriority -1 to ResourceLoadPriority::VeryLow makes sense, so I don&apos;t think I&apos;m going to change that. The reason is that if you don&apos;t set a request priority on the CFURLRequest (meaning CFURLRequestGetRequestPriority returns -1), it actually gets treated as if you had set a priority of 0 (see HTTPConnectionCacheEntry::_prepareNewRequest). So the fact that both -1 and 0 both map to the same value of VeryLow reflects actual behavior.

I could add a new enum value ResourceLoadPriority::Unspecified for this -1 case, which would probably be the best idea if I was starting from scratch. But it doesn&apos;t seem like a worthwhile refactoring given that this current mapping of -1 to VeryLow has been the same for years (until I accidentally removed it) and reflects reality.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>422766</attachid>
            <date>2021-03-09 15:22:07 -0800</date>
            <delta_ts>2021-03-09 15:22:07 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-222998-20210309152206.patch</filename>
            <type>text/plain</type>
            <size>1628</size>
            <attacher name="Ben Nham">nham</attacher>
            
              <data encoding="base64">U3VidmVyc2l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