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

Random crashes with encrypted realm. #7629

Closed
TheHmmka opened this issue Jan 24, 2022 · 15 comments
Closed

Random crashes with encrypted realm. #7629

TheHmmka opened this issue Jan 24, 2022 · 15 comments
Assignees
Labels
Needs-Attention Reporter has responded. Review comment. O-Community T-Bug

Comments

@TheHmmka
Copy link

How frequently does the bug occur?

All the time

Description

Application constantly crashes in random transactions.

Stacktrace & log output

uncaught exception in notifier thread: N5realm5_impl17TransactLogParser14BadTransactLogE: Bad transaction log
2022-01-24 18:16:38.391094+0300 Walken[15692:3232033] uncaught exception in notifier thread: N5realm5_impl17TransactLogParser14BadTransactLogE: Bad transaction log
libc++abi: terminating with uncaught exception of type realm::_impl::TransactLogParser::BadTransactLog: Bad transaction log
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
terminating with uncaught exception of type realm::_impl::TransactLogParser::BadTransactLog: Bad transaction log

Can you reproduce the bug?

Yes, always

Reproduction Steps

Version

10.21.1

What SDK flavour are you using?

Local Database only

Are you using encryption?

Yes, using encryption

Platform OS and version(s)

iOS 15

Build environment

Xcode version: 13.2.1
Dependency manager and version: CocoaPods 1.11.2

@TheHmmka
Copy link
Author

I found next description in the Doc, may be it's a reason:

If multiple processes need to access a realm simultaneously, use an unencrypted realm. Encrypted realms cannot be accessed by multiple processes at the same time.
As an alternative, you can store data that you want to encrypt as NSData properties on realm objects. Then, you can encrypt and decrypt individual fields.

@dianaafanador3
Copy link
Contributor

Hi @TheHmmka I see you can reproduce the issue, maybe you can share a repo or a code snippet so we can reproduce it in our side.
The warning on our documentation refers to trying to access a shared realm from different processes, for example a realm stored on a shared group which is used by different apps at the same time?, if this the case that may be the cause of the crash.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jan 25, 2022
@TheHmmka
Copy link
Author

Hi @TheHmmka I see you can reproduce the issue, maybe you can share a repo or a code snippet so we can reproduce it in our side.
The warning on our documentation refers to trying to access a shared realm from different processes, for example a realm stored on a shared group which is used by different apps at the same time?, if this the case that may be the cause of the crash.

Nope, this is not my case.

Sorry, I can't share production code. I'll try to create demo project and catch this issue.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jan 26, 2022
@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Jan 26, 2022
@tfe
Copy link

tfe commented Feb 2, 2022

I've started getting these too, possibly concurrently with starting to use Realm Notifications, or starting to use async/await, all of which happened around the same time.

I am not accessing the Realm from different processes in my case.

@dianaafanador3
Copy link
Contributor

HI @tfe would you mind sharing your stack trace and/or the code where you het the crash, with a little more info we may be able to reproduce the issue.

@tfe
Copy link

tfe commented Feb 3, 2022

@dianaafanador3 I haven't seen it do it in development... all I have is the exception report via Sentry, and it doesn't give very much (unless I'm not looking in the right place?):

libsystem_kernel    0x1b8efab2c  __workq_kernreturn
libsystem_pthread   0x1f25fe13c  _pthread_wqthread

However from their breadcrumbs I can see that it's likely happening during the same operation I mentioned and shared code for over in #7641. It makes sense that that operation would surface issues since it's the most extensive exercise the database receives in the lifecycle of this app.

@sainttail
Copy link

@TheHmmka Got this error when upgrading from realm 10.20.0 to 10.21.1 on iOS 15 both simulator and real device.

Have you try going back to use 10.20.2?
It does not crash for me.

@TheHmmka
Copy link
Author

TheHmmka commented Feb 3, 2022

@TheHmmka Got this error when upgrading from realm 10.20.0 to 10.21.1 on iOS 15 both simulator and real device.

Have you try going back to use 10.20.2? It does not crash for me.

I'll try, thank you!

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Feb 3, 2022
@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Feb 4, 2022
@Saul-Liang
Copy link

We're also seeing this crash on 10.22.0. Downgrading to 10.20.2 seems to fix the issue for us - thanks @sainttail 🙏

@bfichter
Copy link

We're also experiencing this sporadically after upgrading to 10.21.1 with encryption enabled.

@leemaguire
Copy link
Contributor

@bfichter @Saul-Liang can you attach any stack traces?

@dianaafanador3
Copy link
Contributor

This issue may be related to this realm/realm-core#5174

@driq
Copy link

driq commented Mar 26, 2022

What we know so far:

My conclusion:

  • The issue was introduced in Realm core v11.7.0 or v11.8.0
  • Realm-swift v10.21.0 still contained Realm-core 11.6.1, and should work without issues if the above is true

What to try:

PS. I did not expect such relatively major changes in a patch release of Realm-swift, especially considering that Realm core 11.8.0 contains breaking changes (according to it's own changelog). Is there any reason not to adhere to semver?

@sync-by-unito
Copy link

sync-by-unito bot commented Apr 25, 2022

➤ Finn Andersen commented:

Fixed by realm-core 11.14

@sync-by-unito sync-by-unito bot closed this as completed Apr 25, 2022
@TheHmmka
Copy link
Author

TheHmmka commented May 5, 2022

Now encryption works as expected.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs-Attention Reporter has responded. Review comment. O-Community T-Bug
Projects
None yet
Development

No branches or pull requests

9 participants