Skip to content
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

App crash when closing WebView #10189

Closed
Serhy opened this issue Mar 19, 2020 · 4 comments · Fixed by #10200
Closed

App crash when closing WebView #10189

Serhy opened this issue Mar 19, 2020 · 4 comments · Fixed by #10200

Comments

@Serhy
Copy link
Contributor

Serhy commented Mar 19, 2020

Bug Report

Problem

App crashes when WebView is closed via top-left cross icon.
NOTE: In develop builds (nightly 19th March) ...-univeral.apk it may not crash from the first time but if to open-close up to 20 times the same Dapp it may crash.

However with the builds from #10090 (https://status-im-prs.ams3.digitaloceanspaces.com/StatusIm-200318-154045-e28f8e-pr-universal.apk) on Android 9 it crashes with the same stacktrace in logcat from the very first attempt (just open and close DApp).
And also develop nightly builds -x86.apk crashing all the time when autotests are running on emulators.

Expected behavior

Can proceed using app after closing webview

Actual behavior

App crashes and closes. In logcat:


--------- beginning of crash
03-19 16:22:40.911 15236 15253 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 15253 (RenderThread), pid 15236 (status.ethereum)
03-19 16:22:40.976  3305  3305 I SurfaceFlinger: Display 0 HWC layers:
03-19 16:22:40.976  3305  3305 I SurfaceFlinger:     type    |    handle    | flag |  format   |   source crop (l,t,r,b)    |         frame       | name 
03-19 16:22:40.976  3305  3305 I SurfaceFlinger: ------------+--------------+------+-----------+----------------------------+---------------------+------
03-19 16:22:40.976  3305  3305 I SurfaceFlinger:      Device | 0x7009546020 | 0082 | RGBA_8888 |   0.0    0.0 1080.0 2220.0 |    0    0 1080 2220 | im.status.ethereum/im.status.ethereum.MainActivity[15236]#1
03-19 16:22:40.976  3305  3305 I SurfaceFlinger:      Device | 0x7015e536a0 | 0000 | RGBA_8888 |   0.0    0.0 1080.0   72.0 |    0    0 1080   72 | StatusBar[4142]#0
03-19 16:22:40.976  3305  3305 I SurfaceFlinger:      Device | 0x7015e54580 | 0000 | RGBA_8888 |   0.0    0.0 1080.0  144.0 |    0 2076 1080 2220 | NavigationBar[4142]#0
03-19 16:22:40.976  3305  3305 I SurfaceFlinger:      Device | 0x7015a4a340 | 0000 | RGBA_8888 |   0.0    0.0   99.0   99.0 |  513  718  612  817 | Sprite#3
03-19 16:22:40.976  3305  3305 I SurfaceFlinger:      Device | 0x7015a4a180 | 0000 | RGBA_8888 |   0.0    0.0   99.0   99.0 |  554  730  653  829 | Sprite#8
03-19 16:22:40.976  3305  3305 I SurfaceFlinger: 
03-19 16:22:40.985  3827  3988 D InputReader: Input event(7): value=0 when=39976.242501
03-19 16:22:40.985  3827  3988 D InputReader: Input event(7): value=0 when=39976.242501
03-19 16:22:40.985  3827  3988 I InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=39976.242501
03-19 16:22:40.986  3827  3987 I clp-JNI : Add pinfo.  (channel) f8bdfec im.status.ethereum/im.status.ethereum.MainActivity (server) (pkg) AppWindowToken{61411f4 token=Token{31b7c7 ActivityRecord{497d506 u0 im.status.ethereum/.MainActivity t1903}}} 15236 10345 (action) 1

Notes

#9945 seems the PR introduced that bug

Reproduction

  1. Open Status and create new account
  2. Open Browser -> dap.ps (or any other Dapp or website)
  3. Tap top-left X cross icon
    Actual result: App crashes with 03-19 14:15:34.466 24256 24272 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 24272 (RenderThread), pid 24256 (tus.ethereum.pr)

Additional Information

  • Status version: develop nightly 19th of March
  • Operating System: Android and iOS

Logs

(Full crash log:

crashNightly11.txt

@churik
Copy link
Member

churik commented Mar 20, 2020

сс @rachelhamlin

@vitvly
Copy link
Contributor

vitvly commented Mar 20, 2020

Seems that react-native-screens is the cause. It has been introduced in #10176.

Added some more detail here.

@Ferossgp
Copy link
Contributor

Actually the problem is not in react-native-screens but it became visible with it. When the screen is removed from stack the lib clears the screen from memory, and if some functions are called on non-existing components they will crash. I've debugged that bug, and the reason for the crash in develop is that sendToBridge is called when the component is unmounted and there are stale animation listeners. IMO better to fix that memory leak than remove the lib. The memory leak came from the reference which is stored in re-frame. When the reference is extracted from DB, and in DB we remove it (as a callback from the component) - we still have the value passed into functions and the check before sendToBridge is true (cause the ref is not null) but the ref points to an already unexisting component.

@Serhy
Copy link
Contributor Author

Serhy commented Mar 20, 2020

I've got when it reproduced (in develop) 100% on Android 9 / 10
It happens when cursor is in the URL input while user closes WebView. So to reproduce:

  1. Open Status and navigate to Browser
  2. Open dap.ps
  3. Put cursor in URL input (keyboard appears)
  4. Tap X closing webview button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants