Sporadic test failure LangBindHelper_ImplicitTransactions_NoExtremeFileSpaceLeaks on Windows
We had a test failure on Jenkins Windows CI checkWindows_x86_Release
Realm version: 13.9.0 with Debug Disabled
Platform: Windows Server Win32 unknown 10.0.17763.3287 x86
Encryption: Enabled at compile-time (always encrypt = no)
REALM_MAX_BPNODE_SIZE = 1000
REALM_MEMDEBUG = Disabled
sizeof (size_t) * 8 = 32
Compiler supported SSE (auto detect): No
This CPU supports SSE (auto detect): None
Compiler supported AVX (auto detect): No
This CPU supports AVX (AVX1) (auto detect): No
UNITTEST_RANDOM_SEED: 2383776031
Test path prefix: C:\jenkins\workspace\realm_realm-core_PR-6529\build-dir\test\Release
Test resource path: C:\jenkins\workspace\realm_realm-core_PR-6529\build-dir\test\Release\resources\
Number of test threads: 16 (default)
...
Thread[15]: C:\jenkins\workspace\realm_realm-core_PR-6529\test\test_lang_bind_helper.cpp:3440: ERROR in LangBindHelper_ImplicitTransactions_NoExtremeFileSpaceLeaks: Unhandled exception after line 3440 struct realm::SystemError: SetEndOfFile() failed
Another failure.
Thread[03]: C:\jenkins\workspace\realm_realm-core_PR-6670\test\test_lang_bind_helper.cpp:3114: ERROR in LangBindHelper_ImplicitTransactions_NoExtremeFileSpaceLeaks: Unhandled exception after line 3114 struct realm::SystemError: SetEndOfFile() failed: unknown error (1224)
The extra info here is error code 1224, which a brief search reveals this: "ERROR_USER_MAPPED_FILE or error 1224 occurs when you try to delete or overwrite a file which has been mapped by other process." This maybe points to a race of compact vs opening as a mmap'd file.
Possibly fixed by https://github.com/realm/realm-core/pull/6807
Similar error is still happening with core 13.23.2 in Many_ConcurrentReaders test on the same CI builder (see #6508):
Exception during Many_ConcurrentReaders:
Reason: 'SetEndOfFile() failed: unknown error (1224)'
We saw this in the wild (a user report).
Realm error:
2024-03-26 08:04:17 [error]: Realms.Exceptions.RealmException: SetEndOfFile() failed: unknown error (1224)
2024-03-26 08:04:17 [error]: at Realms.NativeException.ThrowIfNecessary()
2024-03-26 08:04:17 [error]: at Realms.SharedRealmHandle.Open(Configuration configuration)
2024-03-26 08:04:17 [error]: at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
2024-03-26 08:04:17 [error]: at Realms.RealmConfigurationBase.CreateRealm()
2024-03-26 08:04:17 [error]: at Realms.Realm.GetInstance(RealmConfigurationBase config)
2024-03-26 08:04:17 [error]: at osu.Game.Database.RealmAccess.getRealmInstance()
2024-03-26 08:04:17 [error]: at osu.Game.Database.RealmAccess.prepareFirstRealmAccess()
Other error in our app around the same time:
2024-03-26 08:04:16 [verbose]: Failed to validate state: System.UnauthorizedAccessException: Access to the path 'C:\Users\hiday\AppData\Roaming\osu\AuthNative.dll' is denied.
2024-03-26 08:04:16 [verbose]: at System.IO.FileSystem.DeleteFile(String fullPath)
2024-03-26 08:04:16 [verbose]: at osu.Framework.Platform.NativeStorage.Delete(String path)
2024-03-26 08:04:16 [verbose]: at .()
2024-03-26 08:04:16 [verbose]: Loading module...
2024-03-26 08:04:16 [verbose]: Module loaded successfully.
The only way we can imagine this happening is a virus scanner / windows defender had the file open and was denying access to the realm database (and other files) in our app.