What happened
Samsung Note 20 Ultra 5G User of our React-Native application cannot load into app. It falls back to our Sentry Error Boundary as soon as they launch it.
Sentry raised the error to us as Failed to open Realm file at path '/data/data//files/default.realm': Failed to memory buffer:Invalid top array size (ref: 5104, array size: 0) file size: 0, read lock size: none, read lock version: none
What did we expect?
User to be brought to the login page of our application.
Additional context
We have various other users using Samsung devices, I unfortunately do not have the Note 20 specifically, however have tested on an "Samsung Galaxy A21s" and have not been able to replicate.
I was also not able to replicate it and on two different Android emulator SDK versions API 33 (Android 13 Tiramusu, which is the same as the affected user) and API 30 (Android 30)
I did notice one permission differences on their android device, however even after connecting my emulator to adb and running
pm revoke <our_package> android.permission.READ however that gave me an "Unknown permission" error
I do wonder if this could be some sort of permission/os related write access issue but unfortunately I'm not familiar enough to know this. Happy to provide any extra details/context that you might need.
Stacktrace & log output
Error: Failed to open Realm file at path '/data/data/<our_package>/files/default.realm': Failed to memory buffer:Invalid top array size (ref: 5104, array size: 0) file size: 0, read lock size: none, read lock version: none
at Realm_get_shared_realm(native)
at mixedToBinding(node_modules/realm/dist/bundle.react-native.js:4298:48)
at List#constructor(node_modules/realm/dist/bundle.react-native.js:5878:28)
at parse(node_modules/uuid/dist/parse.js:28:9)
at updateSlot(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3070:14)
at shouldConstruct(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:9189:26)
at M(node_modules/react/cjs/react.production.min.js:15:294)
at generateUUID(node_modules/uuid/dist/v35.js:56:16)
at trackUsedThenable(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:2733:7)
at ResponderTouchHistoryStore.recordTouchTrack(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:306:20)
at recursivelyTraverseLayoutEffects(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7351:32)
at commitMutationEffectsOnFiber(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7105:45)
at commitMutationEffectsOnFiber(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7095:7)
at findCurrentFiberUsingSlowPath(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1346:9)
at ResponderEventPlugin.extractEvents(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:553:24)
at <global>(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:147:15)
at <global>(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:378:18)
at flushPassiveEffects(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8575:38)
at apply(native)
at __callFunction(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:435:24)
at invokeCallbackAndReturnFlushedQueue(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:123:17)
at __guard(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:365:9)
at __guard$argument_0(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:35
Viewing the full stack trace on sentry also mentions these bits specifically for MongoDB Realm
Stack Trace, I can provide the remainder but it appears to just be minified react native logic.
native in Realm_get_shared_realm
node_modules/realm/dist/bundle.react-native.js in mixedToBinding at line 4298:48
}
}
// Convert typed arrays to an `ArrayBuffer`
for (const TypedArray of TYPED_ARRAY_CONSTRUCTORS) {
if (value instanceof TypedArray) {
return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength);
}
}
// Rely on the binding for any other value
return value;
}
node_modules/realm/dist/bundle.react-native.js in List#constructor at line 5878:28
throw new IllegalConstructorError("List");
}
super(realm, internal.asResults(), helpers);
// Getting the `objectSchema` off the internal will throw if base type isn't object
const baseType = this.results.type & ~960 /* binding.PropertyType.Flags */;
const isEmbedded = baseType === 7 /* binding.PropertyType.Object */ && internal.objectSchema.tableType === 1 /* binding.TableType.Embedded */;
Object.defineProperty(this, "internal", {
enumerable: false,
configurable: false,
writable: false,
value: internal,
react_native_context
react_native_context
component_stack
in Unknown in RNGestureHandlerRootView in GestureHandlerRootView in RNCSafeAreaProvider in SafeAreaProvider in ErrorBoundary in App in ReactNativeProfiler in RCTView in Unknown in __Sentry.TouchEventBoundary in RootApp in RCTView in Unknown in AppContainer
expo
true
fabric
false
hermes_debug_info
false
hermes_version
for RN 0.74.1
js_engine
hermes
react_native_version
0.74.2
turbo_module
false
How frequently does the bug occur?
Always
Description
What happened Samsung Note 20 Ultra 5G User of our React-Native application cannot load into app. It falls back to our Sentry Error Boundary as soon as they launch it.
Sentry raised the error to us as Failed to open Realm file at path '/data/data//files/default.realm': Failed to memory buffer:Invalid top array size (ref: 5104, array size: 0) file size: 0, read lock size: none, read lock version: none
What did we expect? User to be brought to the login page of our application.
Additional context We have various other users using Samsung devices, I unfortunately do not have the Note 20 specifically, however have tested on an "Samsung Galaxy A21s" and have not been able to replicate.
I was also not able to replicate it and on two different Android emulator SDK versions API 33 (Android 13 Tiramusu, which is the same as the affected user) and API 30 (Android 30)
I did notice one permission differences on their android device, however even after connecting my emulator to adb and running
pm revoke <our_package> android.permission.READ
however that gave me an "Unknown permission" errorSentry Reported Permissions for affected user:
I do wonder if this could be some sort of permission/os related write access issue but unfortunately I'm not familiar enough to know this. Happy to provide any extra details/context that you might need.
Stacktrace & log output
Can you reproduce the bug?
No
Reproduction Steps
Device Information
Realm Config
export const Realm = createRealmContext(realmConfig);
MinimalContext Featire Integration
Minimal App.tsx
Explicit Permissions in app.json "permissions": [ "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_MEDIA_LOCATION", "android.permission.RECORD_AUDIO" ]
Version
12.3.0
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Android 13 & API 33, React Native
Build environment
Cocoapods version
No response