Skip to content

Pixel on Android 14+ hardlocks when getting instance in /storage/emulated/0/Android/data/<appname>/files #7950

@Joehuu

Description

@Joehuu

What happened?

Hello, I'm a regular contributor in osu! and we haven't updated since 11.5.0. Paper trail here: ppy/osu#27920

This issue mentioned in the title is happening since https://github.com/realm/realm-dotnet/releases/tag/11.6.1. I have a Pixel 6a on Android 14, but this may affect any Pixel on Android 14. I am emphasizing Pixel because an osu! dev doesn't experience such an issue on a non-pixel on Android 14: ppy/osu#27920 (comment).

Also throwing in phones from users experiencing the issue the last time we bumped Realm >=11.6.1 to production: Xperia 1 V and AQUOS R8 pro. Those phones are capable of running Android 14. Ref: ppy/osu#27738

Repro steps

The below is similar to what I think osu! does in it's getConfiguration(): https://github.com/ppy/osu/blob/565107205c60f14488f1642011808d286d712c31/osu.Game/Database/RealmAccess.cs#L745 (namely storage.GetFullPath(filename ?? Filename, true)). If you want to test osu! side, remove that storage.GetFullPath() and it should run. Revert and it'll get stuck.

Apply this diff and run. It should get stuck at this line:

realm = Realm.GetInstance(@"/storage/emulated/0/Android/data/com.companyname.quickjournal/files/client.realm");
diff --git a/examples/QuickJournal/QuickJournal.csproj b/examples/QuickJournal/QuickJournal.csproj
index a3e4d124..f3c930b8 100644
--- a/examples/QuickJournal/QuickJournal.csproj
+++ b/examples/QuickJournal/QuickJournal.csproj
@@ -44,7 +44,7 @@
 		<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
 		<PackageReference Include="CommunityToolkit.Maui" Version="5.2.0" />
 		<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
-		<PackageReference Include="Realm" Version="11.3.0" />
+		<PackageReference Include="Realm" Version="12.3.0" />
 		<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
 		  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
 		  <PrivateAssets>all</PrivateAssets>
diff --git a/examples/QuickJournal/ViewModels/EntriesViewModel.cs b/examples/QuickJournal/ViewModels/EntriesViewModel.cs
index a57f41e9..52a3a31e 100644
--- a/examples/QuickJournal/ViewModels/EntriesViewModel.cs
+++ b/examples/QuickJournal/ViewModels/EntriesViewModel.cs
@@ -17,7 +17,8 @@ public partial class EntriesViewModel : ObservableObject
 
         public EntriesViewModel()
         {
-            realm = Realm.GetInstance();
+            Directory.CreateDirectory(@"/storage/emulated/0/Android/data/com.companyname.quickjournal/files");
+            realm = Realm.GetInstance(@"/storage/emulated/0/Android/data/com.companyname.quickjournal/files/client.realm");
             Entries = realm.All<JournalEntry>();
 
             // We are using a WeakReferenceManager here to get notified when JournalEntriesDetailPage is closed.
@@ -78,4 +79,4 @@ private async void EntryModifiedHandler(object recipient, EntryModifiedMessage m
             }
         }
     }
-}
\ No newline at end of file
+}

Version

8.0

What Atlas Services are you using?

Local Database only

What type of application is this?

Other

Client OS and version

Android 14 (Pixels), since https://github.com/realm/realm-dotnet/releases/tag/11.6.1

Code snippets

No response

Stacktrace of the exception/crash you're getting

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions