title: Android Webview - chromium shows ANR when method webView.loadUrl is called (with headers)
body: <p>We have an application that uses Android webview and we have noticed since 04/07/2021 ANRs when call the code below (The code is called in UIThread):</p>
  <pre><code>public void onLoadUrlWithHeaders(final String url, final Map&lt;String, String&gt; headers) {
          Log.d(TAG, &quot;onLoadUrl with headers : &quot; + url);
          webView.loadUrl(url, headers);
      }
  </code></pre>
  <p>The problem is intermittent, and only happens on some devices. For exemple on our test devices:
  Motorola Moto X (4) Android 9 (SDK 28)</p>
  <p>Samsung SM - A520F Android 8 (SDK 26) - <strong>Webview Chrome 90.0.4430.82</strong></p>
  <p>The problem is happening in a version of our app released in December 2020 and that version had not been presenting the mentioned ANR until April.</p>
  <p><strong>excerpt from the /data/anr/traces.txt file of A520F after the ANR</strong></p>
  <pre><code>suspend all histogram:  Sum: 340.474ms 99% C.I. 0.042ms-187.678ms Avg: 4.365ms Max: 283.301ms
  DALVIK THREADS (69):
  &quot;Signal Catcher&quot; daemon prio=5 tid=3 Runnable
    | group=&quot;system&quot; sCount=0 dsCount=0 flags=0 obj=0x13680248 self=0x7d302c1400
    | sysTid=15932 nice=0 cgrp=default sched=0/0 handle=0x7d254fe4f0
    | state=R schedstat=( 0 0 0 ) utm=2 stm=3 core=3 HZ=100
    | stack=0x7d25404000-0x7d25406000 stackSize=1005KB
    | held mutexes= &quot;mutator lock&quot;(shared held)
    native: #00 pc 0000000000397510  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+212)
    native: #01 pc 000000000045dce8  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+348)
    native: #02 pc 000000000047549c  /system/lib64/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+880)
    native: #03 pc 000000000046d774  /system/lib64/libart.so (_ZN3art10ThreadList13RunCheckpointEPNS_7ClosureES2_+480)
    native: #04 pc 000000000046d17c  /system/lib64/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+796)
    native: #05 pc 000000000046cd1c  /system/lib64/libart.so (_ZN3art10ThreadList14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+920)
    native: #06 pc 00000000004426f0  /system/lib64/libart.so (_ZN3art7Runtime14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+196)
    native: #07 pc 000000000044bb88  /system/lib64/libart.so (_ZN3art13SignalCatcher13HandleSigQuitEv+1676)
    native: #08 pc 000000000044a9c0  /system/lib64/libart.so (_ZN3art13SignalCatcher3RunEPv+388)
    native: #09 pc 0000000000067d04  /system/lib64/libc.so (_ZL15__pthread_startPv+200)
    native: #10 pc 000000000001f348  /system/lib64/libc.so (__start_thread+68)
    (no managed stack frames)
  
  &quot;main&quot; prio=5 tid=1 Native
    | group=&quot;main&quot; sCount=1 dsCount=0 flags=1 obj=0x731fda50 self=0x7d302c0a00
    | sysTid=15926 nice=-10 cgrp=default sched=0/0 handle=0x7d353e19c8
    | state=R schedstat=( 0 0 0 ) utm=4634 stm=638 core=2 HZ=100
    | stack=0x7fd505c000-0x7fd505e000 stackSize=8MB
    | held mutexes=
    kernel: (couldn't read /proc/self/task/15926/stack)
    native: #00 pc 00000000035e867c  /data/app/com.android.chrome-ZK4DDobzNyyzf7J8pPGLPg==/base.apk (???)
    native: #01 pc 00000000033e32d8  /data/app/com.android.chrome-ZK4DDobzNyyzf7J8pPGLPg==/base.apk (???)
    at J.N.MAqmDh4t(Native method)
    **at org.chromium.content.browser.framehost.NavigationControllerImpl.c(chromium-Monochrome.aab-stable-443008223:17)
    at org.chromium.android_webview.AwContents.w(chromium-Monochrome.aab-stable-443008223:35)
    at org.chromium.android_webview.AwContents.v(chromium-Monochrome.aab-stable-443008223:14)
    at com.android.webview.chromium.WebViewChromium.loadUrl(chromium-Monochrome.aab-stable-443008223:5)**
    at android.webkit.WebView.loadUrl(WebView.java:927)
    at br.com.gabba.box.l.o(:-1)
    at br.com.gabba.box.model.BO.k$a.c(:-1)
    at br.com.gabba.box.model.BO.k$a.b(:-1)
    at br.com.gabba.box.model.BO.LoginAuthBO.i(:-1)
    at br.com.gabba.box.model.BO.LoginAuthBO_.H(:-1)
    at br.com.gabba.box.model.BO.LoginAuthBO_$a.run(:-1)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6944)
    at java.lang.reflect.Method.invoke(Native method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
  </code></pre>
  <p><a href="https://docs.google.com/document/d/1wcgMBBbZqA_kOtjdYrAygcBb5SXzOISYjq5kdZ-UB7o/edit?usp=sharing" rel="nofollow noreferrer">Here is the entire traces.txt</a></p>
  <p><a href="https://groups.google.com/g/google-admob-ads-sdk/c/n6ICjD7JyK4" rel="nofollow noreferrer">Similar problem in Google Mobile Ads SDK Developers</a></p>