Skip to content

WebView recently started crashing on Android on some devices #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lukebaker opened this issue Mar 18, 2019 · 12 comments
Closed

WebView recently started crashing on Android on some devices #430

lukebaker opened this issue Mar 18, 2019 · 12 comments

Comments

@lukebaker
Copy link

Starting on March 14, our app started seeing crash reports from users that have this backtrace:

backtrace:
  #00  pc 0000000001d86b06  /data/app/com.google.android.webview-1gfF7Rp8MIUc8tMyCVn5pg==/lib/arm/libwebviewchromium.so

Our last release was on February 7, so we haven't introduced any changes. Additionally, it doesn't appear to be related to the content that we're showing as all the content we've been showing for the past month also shows the problem.

I was able to duplicate it on the following:

  • Android 5.1.1 running Chrome 72.0.3526.121
  • Android 9 running Chrome 73.0.3683.75

The WebView is inside of a ScrollView with other non-WebView components. On screen load the WebView is visible, but if we scroll down so that the WebView content is fully off the screen, the app will crash.

If I remove the overflow: "hidden" fix, the app will not crash, but the WebView doesn't render properly within the content. Setting the style of the WebView to include opacity: 0.99 also does not render the content properly (i.e., it still needs whatever the overflow: "hidden" fix does).

Here is what I see in logcat:

F/libc    ( 2321): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x210 in tid 2422 (RenderThread)
I/DEBUG   (  358): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  358): UUID: d5116ccd-12dd-45df-a8a0-73da73812fc5
I/DEBUG   (  358): Build fingerprint: 'Sony/D5503/D5503:5.1.1/14.6.A.1.236/2031203603:user/release-keys'
I/DEBUG   (  358): Revision: '0'
I/DEBUG   (  358): ABI: 'arm'
I/DEBUG   (  358): pid: 2321, tid: 2422, name: RenderThread  >>> org.blah.app <<<
I/DEBUG   (  358): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x210
I/DEBUG   (  358):     r0 04000000  r1 00000001  r2 00000000  r3 00000001
I/DEBUG   (  358):     r4 a1172168  r5 00000010  r6 a1172164  r7 00000210
I/DEBUG   (  358):     r8 b6e10e04  r9 9521fbcc  sl 00000000  fp a11725ac
I/DEBUG   (  358):     ip 00000001  sp a1172138  lr 00000031  pc a9f7cafc  cpsr 20010030
I/DEBUG   (  358): 
I/DEBUG   (  358): backtrace:
I/DEBUG   (  358):     #00 pc 01d86afc  /data/app/com.google.android.webview-2/lib/arm/libwebviewchromium.so

I wonder if it is related to #429, but that description does not fit what I see exactly.

@christianbach
Copy link

christianbach commented Mar 18, 2019

@lukebaker I can confirm that the crashes is related. we where seeing the Fatal signal 11 (SIGSEGV) in our production app. Our solution to fixing the problem was setting opacity: 0.99 on the actual webview and keeping overflow: hidden on the container.

@malonguwa
Copy link

malonguwa commented Mar 19, 2019

@christianbach @lukebaker this crash also happens on Samsung S8 Android 8 with similar error "Fatal signal 11 (SIGSEGV) ..... (RenderThread)". when I try to navigate back from any screen included WebView, and I tried @christianbach 's fix, it is working.

Edited: the fix is working under WebView with other components. But does not fix the issue if I have the single webView for the entire screen.

@dlindstrm
Copy link

@malonguwa do you really need to wrap the webview with overflow: hidden if you have a single webview covering the entire screen?

@malonguwa
Copy link

malonguwa commented Mar 19, 2019

@dlindstrm cos when I navigate to my webViewScreen and then click the back button on the left top l, the app crash..... and I guess it is related to the webView component, cos this only happens when navigate back from the WebViewScreen, if no webView everything works well, but this walk around does not work in my case

@Titozzz
Copy link
Collaborator

Titozzz commented Mar 19, 2019

Let's keep all discussion to #429! This will probably help get this solved faster 💯

@gamingumar
Copy link

@lukebaker I can confirm that the crashes is related. we where seeing the Fatal signal 11 (SIGSEGV) in our production app. Our solution to fixing the problem was setting opacity: 0.99 on the actual webview and keeping overflow: hidden on the container.

This solved the issue for me. I was getting a random crash only on android when I navigate back from a screen that was using webview in react navigation.

Only thing I was getting from error log in Android Studio was W/google-breakpad

@zibs
Copy link

zibs commented Aug 16, 2019

@gamingumar Same, using opacity:0.99 on the webview somehow solves it from crashing on android

@KestasVenslauskas
Copy link

KestasVenslauskas commented Sep 18, 2019

Still still persists in Hermes engine. Had to disable it also enable hardwareAcceleration on android.

@hweister
Copy link

Still still persists in Hermes engine. Had to disable it also enable hardwareAcceleration on android.

no, there is nothing related to Hermes engine, it is just an Chrome bug, using opacity: 0.99 can bypass this problem

@ngankt2
Copy link

ngankt2 commented Feb 20, 2020

`const Nav = createStackNavigator({

    IntroSlider: IntroSlider,
    Root: TabNavigator,
    LocationDetail: {screen: LocationDetail},
   .....
}, {

    mode: 'modal', //<---In my case, I added this option and it worked fine. "react-navigation-stack": "^2.0.15",
    headerMode: 'none',
},

);`

@pavjacko
Copy link

opacity: 0.99 works 👍 .
If it does not, make sure your container has at least fixed height.

This works:

<View style={{ overflow: 'hidden', width: '100%', height: 500 }}>
        <WebView style={{ opacity: 0.99 }} />
</View>

This still crashes:

<View style={{ overflow: 'hidden', flex: 1 }}>
        <WebView style={{ opacity: 0.99 }} />
</View>

If your WebView needs to be full screen just use Dimensions.get('window') instead of flex

@jamonholmgren
Copy link
Member

Moved to #429.

@react-native-webview react-native-webview locked and limited conversation to collaborators Jun 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests