react-native: TextView on production nuking app with OverlappingFileLockException

Description

Every some time, the app completely crashes on production and I get this from Sentry:

image

This was also happening on versions previous to 0.72 as well

React Native Version

0.72.0-rc.5

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: Linux 5.15 Arch Linux
  CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
  Memory: 13.30 GB / 31.35 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.14.2
    path: ~/.nvm/versions/node/v18.14.2/bin/node
  Yarn:
    version: 3.5.0
    path: /usr/sbin/yarn
  npm:
    version: 9.5.0
    path: ~/.nvm/versions/node/v18.14.2/bin/npm
  Watchman:
    version: 20221016.020512.0
    path: /usr/sbin/watchman
SDKs:
  Android SDK:
    API Levels:
      - "31"
      - "33"
      - "33"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.2
    System Images:
      - android-33 | Google APIs Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: AI-222.4459.24.2221.9971841
Languages:
  Java:
    version: 11.0.17
    path: /usr/sbin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
npmGlobalPackages:
  "*react-native*": Not 

Steps to reproduce

So Sentry very consistently reports this series of events when this exception happens:

image

But like, judging by the sequence and timing of these events, I think Sentry isn’t really reporting properly? Like the user base is way too microscopic for this exact sequence of events at this exact timing to happen a couple times

Snack, code example, screenshot, or link to a repository

no idea

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 20
  • Comments: 31 (1 by maintainers)

Most upvoted comments

I’m getting this error too, I can’t catch it during testing, only sent by Sentry, has anyone found a solution? This error is also returned in Android 12 and 13 versions “react-native”: “0.70.6”,

@MicroDroid All of our crashes have happened on Android 8.1.0, are you experiencing similar?

image

We’re receiving these crashes also on react-native 0.71.4. Sentry stack trace below. Trying to create a repro but these are intermittent crashes, i’m not sure what’s causing them.

image

(Not a maintainer, just someone who encountered this bug):

I actually tried to see if it’s possible to dig into the android source code to see if I can find the root cause. Since the issues occurs for most people on android 8.1.0, that seems a good starting point.

Android 8.1.0 is api level 27 (Android version history).

The source code is available here: AndroidSDKSources/android-sdk-sources-for-api-level-27.

But the line numbers from the stack traces don’t seem to match the SDK source code of android.widget.TextView… Which makes it impossible to see what’s causing this, for me at least.

Most likely it’s simply a bug in android 8.1.0 that got fixed later. The stack trace shows the exception happens (deep) inside calls within the android SDK code. The only way around it would be to know what specific calls to the SDK trigger this bug and work around it for 8.1.0.

I guess what all of us could try is install an android 8.1.0 emulator and run our apps on that. If that triggers this exception, strip it down to the minimal reproducer.

Same here with RN 0.70.10, tried to reproduce this with Android Emulator on 8.1 Oreo version but no issues. I think you can’t reproduce this issue unless you have one of these devices 😦

Also facing this in production only and on certain android devices, which makes creating a repro extremely hard/impractical.

I get that having a repro is useful for maintainers but when there’s this many people having the same issue surely it’s worth investigating without one? There’s clearly something going on and just repeating “I need a repro” almost makes it sound like it’s denying the fact this issue exists now i.e “If it works on my machine, then it’s fine”. Which I totally get, a lot of the time if people create a repro then they find the cause of their issues. (I’ve personally done this many many times). Just seems like this one is not the case.

All the stack traces are the exact same, and it’s on certain android devices in production, surely that’s enough proof.

java.nio.channels.OverlappingFileLockException: null
    at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
    at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
    at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1080)
    at java.nio.channels.FileChannel.lock(FileChannel.java:1053)
    at dalvik.system.MdaUtils.writeTo(MdaUtils.java:270)
    at android.widget.TextView.setText(TextView.java:5410)
    at android.widget.TextView.setText(TextView.java:5252)
    at android.widget.EditText.setText(EditText.java:113)
    at android.widget.TextView.setText(TextView.java:5209)

p.s I understand this is open source and i’m by no means trying to imply that maintainers owe anyone anything, i’m more calling out the general ethos of this whole “if there’s no repro, there’s no issue”. Which sometimes is the case, but sometimes not… 😃

Has anyone found a solution for this? I’m getting this error too 😕

I seem to be hitting this issue on Android 11 now too. I have had 3 crashes. I am still unable to reproduce this bug, at all. Has anyone been able to?

image

I’m hitting the same issue. IMG_5884