react-native
react-native copied to clipboard
TextView on production nuking app with OverlappingFileLockException
Description
Every some time, the app completely crashes on production and I get this from Sentry:
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:
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
:warning: | Missing Reproducible Example |
---|---|
:information_source: | It looks like your issue is missing a reproducible example. Please provide either:
|
we really need a repro 😅 on RNTester we have a Text component test page and I always check it out to ensure that it all works, so... really hard to understand what's going on.
Also, can you try RC6 and see if it's still there?
@kelset The problem is that I was never able to reproduce this on my end either, despite using RN for quite a long time now. I guess I can't help much beyond report the bug.
As for RC6, I'll ship that to users over the next week and I'll see then what goes
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.
Happened on production with RC6 too, but this time same stack as above ^
@MicroDroid All of our crashes have happened on Android 8.1.0, are you experiencing similar?
@piers-smartwyre hmmm yes
^^ same
still waiting for a repro 🙃
I’m hitting the same issue.
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?
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 :(
Seeing the exact same issue (same error and stack trace) in our Sentry.
Samsung Galaxy A70 device Android 8.1.0 RN 0.70.8
Same error, after upgrading from 0.70.10 to 0.70.12. Seen on Android 8.1 (Google Play test devices?), haven't been able to reproduce on Android 13.
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.TextView.setText(TextView.java:5209)
at com.facebook.react.views.text.ReactTextView.setText(ReactTextView.java:371)
at com.facebook.react.views.text.ReactTextViewManager.updateExtraData(ReactTextViewManager.java:93)
at com.facebook.react.views.text.ReactTextViewManager.updateExtraData(ReactTextViewManager.java:37)
at com.facebook.react.uimanager.NativeViewHierarchyManager.updateViewExtraData(NativeViewHierarchyManager.java:157)
at com.facebook.react.uimanager.UIViewOperationQueue$UpdateViewExtraData.execute(UIViewOperationQueue.java:248)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:655)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6536)
at java.lang.reflect.Method.invokeImpl(Method.java)
at java.lang.reflect.Method.invoke(Method.java:411)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:808)
Same issue as well. Also only been seeing it on Android 8.1
sun.nio.ch.SharedFileLockTable in checkList at line 255
sun.nio.ch.SharedFileLockTable in add at line 152
sun.nio.ch.FileChannelImpl in lock at line 1080
java.nio.channels.FileChannel in lock at line 1053
dalvik.system.MdaUtils in writeTo at line 270
android.widget.TextView in setText at line 5410
android.widget.TextView in setText at line 5252
android.widget.TextView in setText at line 5209
com.facebook.react.views.text.ReactTextView in setText at line 373
com.facebook.react.views.text.ReactTextViewManager in updateExtraData at line 90
com.facebook.react.views.text.ReactTextViewManager in updateExtraData at line 34
com.facebook.react.uimanager.NativeViewHierarchyManager in updateViewExtraData at line 157
com.facebook.react.uimanager.UIViewOperationQueue$UpdateViewExtraData in execute at line 248
com.facebook.react.uimanager.UIViewOperationQueue$1 in run at line 915
com.facebook.react.uimanager.UIViewOperationQueue in flushPendingBatches at line 1026
com.facebook.react.uimanager.UIViewOperationQueue in access$2600 at line 47
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback in doFrameGuarded at line 1086
com.facebook.react.uimanager.GuardedFrameCallback in doFrame at line 29
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher in doFrame at line 175
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1 in doFrame at line 85
android.view.Choreographer$CallbackRecord in run at line 909
android.view.Choreographer in doCallbacks at line 723
android.view.Choreographer in doFrame at line 655
android.view.Choreographer$FrameDisplayEventReceiver in run at line 897
android.os.Handler in handleCallback at line 790
android.os.Handler in dispatchMessage at line 99
android.os.Looper in loop at line 164
android.app.ActivityThread in main at line 6536
java.lang.reflect.Method in invokeImpl
java.lang.reflect.Method in invoke at line 411
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 468
com.android.internal.os.ZygoteInit in main at line 808
Same issue on android 8.1 vivo S1
`sun.nio.ch.SharedFileLockTable in checkList at line 255
sun.nio.ch.SharedFileLockTable in add at line 152 sun.nio.ch.FileChannelImpl in lock at line 1080
java.nio.channels.FileChannel in lock at line 1053
dalvik.system.MdaUtils in writeTo at line 270
android.widget.TextView in setHint at line 5572
com.facebook.react.views.textinput.ReactTextInputShadowNode in measure at line 129
com.facebook.yoga.YogaNodeJNIBase in measure at line 523
com.facebook.yoga.YogaNative in jni_YGNodeCalculateLayoutJNI
com.facebook.yoga.YogaNodeJNIBase in calculateLayout at line 221
com.facebook.react.uimanager.ReactShadowNodeImpl in calculateLayout at line 466
com.facebook.react.uimanager.UIImplementation in calculateRootLayout at line 925
com.facebook.react.uimanager.UIImplementation in updateViewHierarchy at line 647
com.facebook.react.uimanager.UIImplementation in dispatchViewUpdates at line 608
com.facebook.react.uimanager.UIImplementation in dispatchViewUpdatesIfNeeded at line 623
com.facebook.react.uimanager.UIImplementation in setViewLocalData at line 206
com.facebook.react.uimanager.UIManagerModule$2 in runGuarded at line 455
com.facebook.react.bridge.GuardedRunnable in run at line 30
android.os.Handler in handleCallback at line 790
android.os.Handler in dispatchMessage at line 99
com.facebook.react.bridge.queue.MessageQueueThreadHandler in dispatchMessage at line 27
android.os.Looper in loop at line 164
com.facebook.react.bridge.queue.MessageQueueThreadImpl$4 in run at line 228
java.lang.Thread in run at line 764
`
Same issue
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",
We are getting this error too, on react-native 0.72.6. Just like the earlier replies (bar one) the crash happened on Android 8.1.0. Stack trace is exactly the same
Has anyone found a solution for this? I'm getting this error too 😕
Has anyone found a solution for this? You can find my code below where the error happens:
import React, { useEffect, useRef } from "react"
import { SafeAreaView, StyleSheet, View, Image, ActivityIndicator } from "react-native"
import { Input, Button, Text, Icon } from "@rneui/themed"
import { useContext, useState } from "react"
import loginApi from "../api/loginApi"
import rules from "../utils/rules"
import localLoginApi from "../api/localLoginApi"
import AsyncStorage from "@react-native-async-storage/async-storage"
import { AuthContext } from "../store/AuthContext"
import { CheckBox } from "@rneui/base"
import t from "../locales/translation"
import Constants from 'expo-constants';
import { registerBackgroundFetchAsync } from "../taskmanagers/backgroundRefreshTokenTask"
import { ScrollView } from "react-native-gesture-handler"
import { ThemeContext } from "../store/ThemeContext"
import * as Updates from 'expo-updates';
import * as Network from 'expo-network';
const LoginPage = ({ navigation }) => {
const [ username, setUsername ] = useState('')
const [ password, setPassword ] = useState('')
const [ showPass, setShowPass ] = useState(true)
const [ error, setError ] = useState(false)
const [ loading, setLoading ] = useState(false)
const [ staySignIn, setStaySignIn ] = useState(false)
const authCtx = useContext(AuthContext)
const themeCtx = useContext(ThemeContext)
const networkStatusRef = useRef(true);
const logIn = async () => {
setLoading(true)
loginApi
.postLogin( username, password )
.then(response => {
if (response && response.status === 200) {
loginApi
.getUserInformation()
.then(res => {
if (res.data) {
authCtx.setUser(res.data)
authCtx.setLogInStatus(true)
setTimeout(() => {
authCtx.authenticate( 'Bearer ' + response.data.access_token)
navigation.navigate("HomePage")
setLoading(false)
}, 200);
registerBackgroundFetchAsync();
if (staySignIn) {
AsyncStorage.setItem('staySignIn', 'true')
}
}
})
}
})
.catch((e) => {
console.log(e)
setLoading(false)
setError(true)
setTimeout(() => setError(false), 3000)
})
}
const localLogin = async () => {
setLoading(true)
localLoginApi
.postlocalLogin()
.then(res => {
if (res && res.status === 200) {
// In case open app --> log in page
authCtx.setUser(res.data)
authCtx.setLogInStatus(true)
setTimeout(() => {
authCtx.authenticate('token')
navigation.navigate("HomePage")
}, 200 )
}
})
.finally(() => setLoading(false))
.catch((e) => {
console.log(e)
setLoading(false)
setError(true)
setTimeout(() => setError(false), 3000)
})
}
useEffect(() => {
const getNetwork = async () => {
try {
const networkStatus = await Network.getNetworkStateAsync();
if (!networkStatus.isConnected) {
networkStatusRef.current = false;
alert(`${t('Network error', 'fi')}`);
setTimeout(() => (networkStatusRef.current = true), 3000);
} else {
networkStatusRef.current = true;
}
} catch (error) {
console.error('Error checking network status:', error);
}
};
getNetwork();
}, []);
useEffect(() => {
async function onFetchUpdateAsync() {
try {
const update = await Updates.checkForUpdateAsync();
if (update.isAvailable) {
await Updates.fetchUpdateAsync();
await Updates.reloadAsync();
}
} catch (error) {
if (networkStatusRef.current) {
alert(`${t('Expo update error', 'fi')}`)
}
}
}
onFetchUpdateAsync()
}, [])
return(
<SafeAreaView style={{ backgroundColor: "#fafafa", height: "100%" }}>
<ScrollView>
{ error && <View style={ styles.errorCard }>
<Text style={ styles.errorText }>Sorry, error occurs and we are unable to log you in. Please try again</Text>
</View> }
{loading && <ActivityIndicator size='large' color="#37609D" style={{marginTop: 36}}/>}
{ !loading && <View style= { styles.container }>
<View style={ styles.logoContainer }>
<Text style={{ ...styles.welcomeText, ...themeCtx.fontSize }}> Welcome </Text>
<Text style={{marginTop: 12, color: "#999", ...themeCtx.fontSize }}>v {Constants.expoConfig.version}</Text>
</View>
<View>
<Input
value={ username }
onChangeText={value => setUsername(value)}
placeholder={t('Username',null)}
inputContainerStyle={ styles.input }
/>
</View>
<View>
<Input
value={ password }
onChangeText={value => setPassword(value)}
placeholder={t('Password', null)}
inputContainerStyle={ styles.input }
secureTextEntry={ showPass }
errorStyle={{ color: 'red', ...themeCtx.fontSize }}
errorMessage={ t(rules.password(password), null) }
rightIcon={
<Icon
onPress={() => setShowPass(!showPass)}
name={ showPass ? 'visibility-off' : 'visibility'}
type=' material-icon '
size={24}
color='black'
/>
}
/>
</View>
<View>
<CheckBox
title={ t('Stay signed in', null) }
containerStyle={{ backgroundColor: '#fafafa', borderWidth: 0, marginLeft: -2 }}
textStyle={{ ...themeCtx.fontSize }}
iconType="material-community"
checkedIcon="checkbox-outline"
uncheckedIcon={'checkbox-blank-outline'}
checked={staySignIn}
onPress={ () => setStaySignIn((staySignIn) => staySignIn = !staySignIn)}
/>
</View>
<Button onPress={logIn} title={t('Log in', null)} buttonStyle={ styles.btn } titleStyle={{...themeCtx.fontSize }}></Button>
{/* Local development button cames here... */}
</View> }
</ScrollView>
</SafeAreaView>
)
}
export default LoginPage
Found the same issue Android - 8.1.0 RN - 0.72.6 Expo - 49.0.21
any update on this issue? I faced similar issue on production build
@kelset I am seeing this error too and would love to get a reproduction but it's only happening in production and I don't have enough information to get a reproduction for you. Any other options to help debug this?
Same bug for me Xiaomi Mi 9X Android 8.1.0 RN 0.73 Expo - Version 50
My Repo - https://github.com/ElSierra/naija-dictionary
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... :)
(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.
If you don't have a repro, can you open source your project and add the link to the relevant code in this conversation? Thanks
For what it's worth, we noticed this issue as soon as Google Play's pre-launch report testing kicked in. They seem to use a variety of devices, some in weirder configurations than others. Would a rooted device be a factor in triggering this error?
We haven't released publicly yet, so I have no data points to share on what would happen on actual users' devices.