Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EncryptionKeyCheck test failure on exfat #7156

Closed
kiburtse opened this issue Nov 20, 2023 · 1 comment · Fixed by #7162
Closed

EncryptionKeyCheck test failure on exfat #7156

kiburtse opened this issue Nov 20, 2023 · 1 comment · Fixed by #7162

Comments

@kiburtse
Copy link
Contributor

Expected results

Test pass

Actual Results

test_shared.cpp:2213: ERROR in Shared_EncryptionKeyCheck_3: Unhandled exception after line 2213 realm::InvalidDatabase: Failed to open Realm file at path '...': Realm file decryption failed (Decryption failed)

Steps & Code to Reproduce

Reproduces somewhat often when relevant tests run on exfat fs:

UNITTEST_KEEP_FILES=1 UNITTEST_FILTER=*_EncryptionKey* ./test/realm-tests.app/Contents/MacOS/realm-tests /Volumes/exfat/

CI run with logs but there is nothing other than logged exception

With added logs and additional checks it can be seen where it fails (one such example):

Thread[2]: /Users/user/r/core/test/test_shared.cpp:2197: ERROR in Shared_EncryptionKeyCheck: CHECK_NOTHROW(db = DB::create(path, false, DBOptions(crypt_key(true)))) failed: Did throw realm::InvalidDatabase: Failed to open Realm file at path '/Volumes/SD8/tmp/Shared_EncryptionKeyCheck.1.path.realm': Realm file decryption failed (Decryption failed: 'refresh_page failed: 18, 0, , 16384, 0, 24')                     
Thread[2]: /Users/user/r/core/test/test_shared.cpp:2198: ERROR in Shared_EncryptionKeyCheck: CHECK(db) failed
Thread[2]: /Users/user/r/core/test/test_shared.cpp:2200: ERROR in Shared_EncryptionKeyCheck: CHECK_NOTHROW(db = DB::create(path, false, DBOptions(crypt_key(true)))) failed: Did throw realm::InvalidDatabase: Failed to open Realm file at path '/Volumes/SD8/tmp/Shared_EncryptionKeyCheck.1.path.realm': Realm file decryption failed (Decryption failed: 'refresh_page failed: 8, 0, , 16384, 0, 24')                      
Thread[2]: /Users/user/r/core/test/test_shared.cpp:2201: ERROR in Shared_EncryptionKeyCheck: CHECK(db) failed
FAILURE: 1 out of 3 tests failed (4 out of 15 checks failed).
Test time: 132.56ms
Note: 1576 tests were excluded!

Top 3 time usage:
-------------------------------------
Shared_EncryptionKeyCheck    132.48ms
Shared_EncryptionKeyCheck_3   18.28ms
Shared_EncryptionKeyCheck_2   18.28ms

All three relevant test should run concurrently to trigger the issue from what i can tell. Resulting realm files will be invalid and can't be read after such failure: realm-trawler will report the same DecryptionFailed error. I suspect it's the same type of issue as here #6959 since encrypted mapping also uses file uids.

Core version

Core version: 13.23.4

@kiburtse
Copy link
Contributor Author

@ironage does this look like the same cause to you? If this fails on 0 >= 24, that means that the block wasn't written on encrypted page at all?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant