title: Android webview segfaults on display
body: <p>I have a webview in a fragment. It has been working fine for a few months. I was playing around with the HTML embedded in it (a generated string) and i think it had a bad font reference. </p>
  
  <p>The result is that now on one device this webview <em>always</em> segfaults when it displays - but only on the one device (a Galaxy Nexus) i was testing on - testing on other devices it all works fine. it load in the background in a viewpager so I know it initialises properly but when it display it always segfaults the app on this device. </p>
  
  <p>So it <em>looks like</em> there is some cached data somewhere that is not being cleared. I cant understand why the same apk works on all other devices (all android versions - but only crashes on this one device.</p>
  
  <p>i have tried to clear the cache using </p>
  
  <pre><code>_web.clearCache(true);
  webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
  </code></pre>
  
  <p>but no difference. Are there any other caches i can clear?
  I have rebooted the phone - no difference.</p>
  
  <p>Looking for any ideas on how to resolve this error - no matter how crazy!</p>
  
  <p>Here is the segfault - looks to be OpenGL related - 
   -does the webview use opengl for fonts? 
  - Is there a font cache for the webview?</p>
  
  <pre><code>D/TilesManager( 5776): new EGLContext from framework: 50c5df28 
  D/GLWebViewState( 5776): Reinit shader
  W/webcore ( 5776): skip viewSizeChanged as w is 0
  D/GLWebViewState( 5776): Reinit transferQueue
  D/MyPodV2 ( 5776): load page:0 - 0.0
  D/MyPodV2 ( 5776): load page:720 - 100.0
  F/libc    ( 5776): Fatal signal 11 (SIGSEGV) at 0x00000008 (code=1), thread 5776 (nelweb.mypod.v2)
  I/DEBUG   (  121): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
  I/DEBUG   (  121): Build fingerprint: 'samsung/yakjuxw/maguro:4.1.1/JRO03C/I9250XWLH2:user/release-keys'
  I/DEBUG   (  121): pid: 5776, tid: 5776, name: nelweb.mypod.v2  &gt;&gt;&gt; co.uk.sentinelweb.mypod.v2 &lt;&lt;&lt;
  I/DEBUG   (  121): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000008
  I/DEBUG   (  121):     r0 00000008  r1 585b7008  r2 00000010  r3 00000004
  I/DEBUG   (  121):     r4 56dbdb90  r5 56dbe9c0  r6 00000001  r7 00000004
  I/DEBUG   (  121):     r8 00000008  r9 00000001  sl 00000004  fp 00000001
  I/DEBUG   (  121):     ip 00000001  sp beac4180  lr 5863688c  pc 5865f774  cpsr 80000010
  I/DEBUG   (  121):     d0  000000003e8374f1  d1  0000000000000000
  I/DEBUG   (  121):     d2  3e8374f100000000  d3  0000000000000000
  I/DEBUG   (  121):     d4  0000000000000000  d5  000000003f800000
  I/DEBUG   (  121):     d6  426d42bcc1248268  d7  3f80000000000000
  I/DEBUG   (  121):     d8  4411c6fc438013e9  d9  4507000000000000
  I/DEBUG   (  121):     d10 43e72bda4481c000  d11 43e670f943e670f9
  I/DEBUG   (  121):     d12 43e670f943e670f9  d13 bfa2695643f6cead
  I/DEBUG   (  121):     d14 00000000bd134ab6  d15 0000000000000000
  I/DEBUG   (  121):     d16 0000000800000000  d17 0000000000000000
  I/DEBUG   (  121):     d18 0000000000000000  d19 0000000000000000
  I/DEBUG   (  121):     d20 3ff0000000000000  d21 0000000000000000
  I/DEBUG   (  121):     d22 0000000000000000  d23 0000000000000000
  I/DEBUG   (  121):     d24 0000000000000000  d25 0000000000000000
  I/DEBUG   (  121):     d26 0000000000000000  d27 0000000000000000
  I/DEBUG   (  121):     d28 0000000000000000  d29 0000000000000000
  I/DEBUG   (  121):     d30 0000000000000000  d31 0000000000000000
  I/DEBUG   (  121):     scr 20000013
  I/DEBUG   (  121): 
  I/DEBUG   (  121): backtrace:
  I/DEBUG   (  121):     #00  pc 00034774  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
  I/DEBUG   (  121):     #01  pc 0000b888  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
  I/DEBUG   (  121): 
  I/DEBUG   (  121): stack:
  I/DEBUG   (  121):          beac4140  03d00000  
  I/DEBUG   (  121):          beac4144  00000000  
  I/DEBUG   (  121):          beac4148  5c7b3dd0  
  I/DEBUG   (  121):          beac414c  586d79f8  
  I/DEBUG   (  121):          beac4150  56dbea6c  
  I/DEBUG   (  121):          beac4154  585b6c7c  /dev/pvrsrvkm
  I/DEBUG   (  121):          beac4158  00000002  
  I/DEBUG   (  121):          beac415c  00000004  
  I/DEBUG   (  121):          beac4160  56dbea6c  
  I/DEBUG   (  121):          beac4164  56dbdb90  
  I/DEBUG   (  121):          beac4168  56dbe9bc  
  I/DEBUG   (  121):          beac416c  00000000  
  I/DEBUG   (  121):          beac4170  00000004  
  I/DEBUG   (  121):          beac4174  00000023  
  I/DEBUG   (  121):          beac4178  df0027ad  
  I/DEBUG   (  121):          beac417c  00000000  
  I/DEBUG   (  121):     #00  beac4180  56dbdb90  
  I/DEBUG   (  121):          ........  ........
  I/DEBUG   (  121):     #01  beac4180  56dbdb90  
  I/DEBUG   (  121):          beac4184  5863688c  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
  I/DEBUG   (  121):          beac4188  56dbdb90  
  I/DEBUG   (  121):          beac418c  00000004  
  I/DEBUG   (  121):          beac4190  00000004  
  I/DEBUG   (  121):          beac4194  00000000  
  I/DEBUG   (  121):          beac4198  00000005  
  I/DEBUG   (  121):          beac419c  5863898c  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
  I/DEBUG   (  121):          beac41a0  56dbdb90  
  I/DEBUG   (  121):          beac41a4  00000004  
  I/DEBUG   (  121):          beac41a8  00000000  
  I/DEBUG   (  121):          beac41ac  5868606c  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
  I/DEBUG   (  121):          beac41b0  00000005  
  I/DEBUG   (  121):          beac41b4  58639a70  /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so (glDrawArrays+804)
  I/DEBUG   (  121):          beac41b8  00000004  
  I/DEBUG   (  121):          beac41bc  00000000  
  I/DEBUG   (  121): 
  I/DEBUG   (  121): memory near r1:
  I/DEBUG   (  121):     585b6fe8 ffffffff ffffffff ffffffff ffffffff  ................
  I/DEBUG   (  121):     585b6ff8 ffffffff ffffffff ffffffff ffffffff  ................
  I/DEBUG   (  121):     585b7008 ffffffff ffffffff ffffffff ffffffff  ................
  I/DEBUG   (  121):     585b7018 ffffffff ffffffff ffffffff ffffffff  ................
  I/DEBUG   (  121):     585b7028 ffffffff ffffffff ffffffff ffffffff  ................
  I/DEBUG   (  121): 
  I/DEBUG   (  121): memory near r4:
  I/DEBUG   (  121):     56dbdb70 10000298 58ec5138 5dc1229f 00000298  ....8Q.X.".]....
  I/DEBUG   (  121):     56dbdb80 58ca335c 5dbf356f 00000000 00000f9b  \3.Xo5.]........
  I/DEBUG   (  121):     56dbdb90 00000018 0000e7fd 00001c80 00001100  ................
  I/DEBUG   (  121):     56dbdba0 00001100 00000024 000003aa 00000064  ....$.......d...
  I/DEBUG   (  121):     56dbdbb0 00000064 00000064 00000064 00000004  d...d...d.......
  I/DEBUG   (  121): 
  I/DEBUG   (  121): memory near r5:
  I/DEBUG   (  121):     56dbe9a0 00000000 00000000 00000000 00000000  ................
  I/DEBUG   (  121):     56dbe9b0 00000000 00000000 56dbe794 56dbe83c  ...........V&lt;..V
  I/DEBUG   (  121):     56dbe9c0 56dbe86c 00000000 00000000 00000000  l..V............
  I/DEBUG   (  121):     56dbe9d0 00000000 00000000 00000000 00000000  ................
  I/DEBUG   (  121):     56dbe9e0 00000002 00000003 00000003 00000004  ................
  I/DEBUG   (  121): 
  I/DEBUG   (  121): memory near sp:
  I/DEBUG   (  121):     beac4160 56dbea6c 56dbdb90 56dbe9bc 00000000  l..V...V...V....
  I/DEBUG   (  121):     beac4170 00000004 00000023 df0027ad 00000000  ....#....'......
  I/DEBUG   (  121):     beac4180 56dbdb90 5863688c 56dbdb90 00000004  ...V.hcX...V....
  I/DEBUG   (  121):     beac4190 00000004 00000000 00000005 5863898c  ..............cX
  I/DEBUG   (  121):     beac41a0 56dbdb90 00000004 00000000 5868606c  ...V........l`hX
  I/DEBUG   (  121): 
  I/DEBUG   (  121): code around pc:
  I/DEBUG   (  121):     5865f754 e781410c e28cc001 e15c0003 3afffffa  .A........\....:
  I/DEBUG   (  121):     5865f764 e8bd8010 e92d4010 e3a0c000 ea000004  .....@-.........
  I/DEBUG   (  121):     5865f774 e5904000 e5014008 e5904004 e0800002  .@...@...@......
  I/DEBUG   (  121):     5865f784 e5014004 e15c0003 e2811008 e28cc001  .@....\.........
  I/DEBUG   (  121):     5865f794 3afffff6 e8bd8010 e92d4010 e3a0c000  ...:.....@-.....
  I/DEBUG   (  121): 
  I/DEBUG   (  121): code around lr:
  I/DEBUG   (  121):     5863686c e3530000 1a000005 e1a03007 e59c0018  ..S......0......
  I/DEBUG   (  121):     5863687c e59c101c e59c2014 e1a0e00f e59cf024  ..... ......$...
  I/DEBUG   (  121):     5863688c e2866001 e2855004 e5942e50 e3a03001  .`...P..P....0..
  I/DEBUG   (  121):     5863689c e1560002 3affffeb e2840eed e1a01008  ..V....:........
  I/DEBUG   (  121):     586368ac e280000c e1a02003 e8bd41f0 eaffe178  ..... ...A..x...
  I/BootReceiver(  316): Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)
  </code></pre>
  
  <p>UPDATE 10/03/13: this is the code that i use to stop caching - obviously i am getting a bit desperate.</p>
  
  <pre><code>_web.clearCache(true);
          _web.setAnimationCacheEnabled(false);
          _web.setDrawingCacheEnabled(false);
          _web.setAlwaysDrawnWithCacheEnabled(false);
          _web.clearHistory();
          _web.clearFormData();
          webSettings.setJavaScriptEnabled(false);
          webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
          webSettings.setAppCacheMaxSize(0);
          webSettings.setAppCachePath("");
          webSettings.setAppCacheEnabled(false);
          getActivity().deleteDatabase("webview.db");
          getActivity().deleteDatabase("webviewCache.db");
          webSettings.setDomStorageEnabled(false);
          webSettings.setLoadsImagesAutomatically(false);
          _web.setWillNotCacheDrawing(true);
          webSettings.setBuiltInZoomControls(false);
          webSettings.setSupportZoom(false);
          webSettings.setSaveFormData(false);
          //_web.setWillNotDraw(true);// loads but stops drawing
          webSettings.setRenderPriority(WebSettings.RenderPriority.LOW);
  </code></pre>
  
  <p>Interesting to note that _web.setWillNotDraw(true); stops the segfault but does not draw anything (which is logical) so that indicates to me that segfault must be in the webview. drawing code. </p>