realm-java: Synced Realm crashes with "Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe0" during the first launch

Goal

The app shouldn’t crash

Actual Results

The app is crashing with

06-26 11:22:42.579 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe0 in tid 11115 (Thread-525)

Steps & Code to Reproduce

This is usually happening when the realm is created for the first time. Sometimes we don’t have any issues but sometimes it crashes on the first run(when there is no realm). I can see that the realm is created successfully using Realm Studio. If it doesn’t crash on the first run, it works flawlessly.

Stacktrace

06-26 10:57:44.927 9584-9584 D/REALM_JAVA: Creating session for: /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome
06-26 10:57:44.929 9584-9584 D/REALM_JAVA: First session created. Adding network listener.
06-26 10:57:44.934 9584-9667 D/REALM_JAVA: Network request (authenticate): https://example-server.us1a.cloud.realm.io/auth
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Realm sync client ([realm-core-6.0.4], [realm-sync-5.0.3])
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Supported protocol versions: 26-30
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Platform: Android Linux 3.10.65+ #1 SMP PREEMPT Wed Jul 13 17:11:32 CST 2016 aarch64
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Build mode: Release
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Config param: max_open_files = 256
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Config param: one_connection_per_session = 1
06-26 10:57:44.948 9584-9584 D/REALM_SYNC: Config param: connect_timeout = 120000 ms
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: connection_linger_time = 30000 ms
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: ping_keepalive_period = 60000 ms
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: pong_keepalive_timeout = 120000 ms
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: fast_reconnect_limit = 60000 ms
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: disable_upload_compaction = 0
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: tcp_no_delay = 0
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: Config param: disable_sync_to_disk = 0
06-26 10:57:44.949 9584-9584 D/REALM_SYNC: User agent string: 'RealmSync/5.0.3 (Android Linux 3.10.65+ #1 SMP PREEMPT Wed Jul 13 17:11:32 CST 2016 aarch64) RealmJava/7.0.0 (Xess, TCL Xess P17AA, v22) '
06-26 10:57:44.949 9584-9584 D/REALM_JNI: Callback to Java requesting token for path: /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome
06-26 10:57:44.950 9584-9668 D/REALM_JNI: SyncClient thread created
06-26 10:57:45.217 9584-9667 D/REALM_JAVA: AuthenticateResponse. Identity user-id; Path /user-id/smarthome
06-26 10:57:45.220 9584-9667 D/REALM_JAVA: Session[/data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome]: Access token acquired
06-26 10:57:45.224 9584-9668 D/REALM_SYNC: Connection[1]: WebSocket::Websocket()
06-26 10:57:45.228 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Binding '/data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome' to '/user-id/smarthome'
06-26 10:57:45.229 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Activating
06-26 10:57:45.233 9584-9668 I/REALM_SYNC: Connection[1]: Session[1]: client_reset_config = true, Realm exists = true, async open = false, client reset = true
06-26 10:57:45.234 9584-9668 I/REALM_SYNC: Connection[1]: Session[1]: Client reset config, metadata_dir = '/data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome.resync', recover_local_changes = true, require_recent_state_realm = true
06-26 10:57:45.235 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Create ClientStateDownload, realm_path = /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome, metadata_dir = /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome.resync
06-26 10:57:45.236 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: ClientStateDownload: initialize_from_new using directory, m_versioned_meta_data_dir = '/data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome.resync/version-1'
06-26 10:57:45.240 9584-9667 D/REALM_JAVA: Scheduling an access_token refresh in 353777 milliseconds
06-26 10:57:45.251 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: client_file_ident = 0, client_file_ident_salt = 0
06-26 10:57:45.252 9584-9668 D/REALM_SYNC: Opening Realm file: /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome
06-26 10:57:45.253 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 0, uploadable = 356, reliable_download_progress = 0, snapshot version = 2
06-26 10:57:45.253 9584-9668 D/REALM_SYNC: Connection[1]: Resolving 'example-server.us1a.cloud.realm.io:443'
06-26 10:57:45.256 9584-9668 D/REALM_SYNC: Connection[1]: Connecting to endpoint '52.52.52.52:443' (1/3)
06-26 10:57:45.463 9584-9668 I/REALM_SYNC: Connection[1]: Connected to endpoint '52.52.52.52:443' (from '10.1.1.19:40686')
06-26 10:57:45.713 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:57:45.724 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:57:45.730 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:57:45.735 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:57:46.016 9584-9668 D/REALM_SYNC: Connection[1]: WebSocket::initiate_client_handshake()
06-26 10:57:46.244 9584-9668 D/REALM_SYNC: Connection[1]: WebSocket::handle_http_response_received()
06-26 10:57:46.244 9584-9668 D/REALM_SYNC: Connection[1]: Negotiated protocol version: 30
06-26 10:57:46.244 9584-9668 D/REALM_SYNC: Connection[1]: Will emit a ping in 50215 milliseconds
06-26 10:57:46.244 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: BIND(path='/user-id/smarthome', signed_user_token_size=839, need_client_file_ident=1, is_subserver=0)
06-26 10:57:46.463 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Received: IDENT(client_file_ident=2, client_file_ident_salt=4308936264579674805)
06-26 10:57:46.463 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Skipping the CLIENT_VERSION_REQUEST since client_file_ident=0
06-26 10:57:46.463 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: STATE_REQUEST(partial_transfer_server_version=0, partial_transfer_server_version_salt=0, end_offset=0, need_recent=1, min_file_format_version=10, max_file_format_version=0, min_history_schema_version=10, max_history_schema_version=0)
06-26 10:57:46.679 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Received: STATE(server_version=0, server_version_salt=0, begin_offset=0, end_offset=0, max_offset=0, chunk size=0)
06-26 10:57:46.698 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: finalize_client_reset, realm_path = /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome
06-26 10:57:46.698 9584-9668 I/REALM_SYNC: Connection[1]: Session[1]: Client reset, path_remote = /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome.resync/version-1/partially_downloaded.realm, path_local = /data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome, encryption = off, client_file_ident.ident = 2, client_file_ident.salt = 4308936264579674805, server_version.version = 0, server_version.salt = 0, downloaded_bytes = 0, client_version = 0, recover_local_changes = true, should_commit_remote = false.
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Local changeset version = 1, size = 356
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: copy_group, src size = 4, dst size = 5
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: key = 1, table_name = class_table1
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Table 'class_table1' will remain
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: key = 2, table_name = class_table2
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Table 'class_table2' will remain
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: key = 3, table_name = class_table3
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: key = 4, table_name = class_table4
06-26 10:57:46.704 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Table 'class_table4' will remain
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: The number of tables is 4
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Removing objects in 'class_table1'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Removing objects in 'class_table2'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Removing objects in 'class_table3'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Removing objects in 'class_table4'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Adding objects in 'class_table1'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Adding objects in 'class_table2'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Adding objects in 'class_table3'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Adding objects in 'class_table4'
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Updating values for table 'class_table1', number of rows = 0, number of columns = 4, primary_key_col = 0, primary_key_type = 2
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Updating values for table 'class_table2', number of rows = 0, number of columns = 4, primary_key_col = 0, primary_key_type = 2
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Updating values for table 'class_table3', number of rows = 0, number of columns = 5
06-26 10:57:46.705 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Updating values for table 'class_table4', number of rows = 0, number of columns = 4, primary_key_col = 0, primary_key_type = 2
06-26 10:57:46.714 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: perform_client_reset_diff is done, old_version.version = 2, old_version.index = 1, new_version.version = 3, new_version.index = 2
06-26 10:57:46.715 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Async open or client reset is completed, path=/data/data/com.some.package.name/files/realm-object-server/user-id/user-id/smarthome
06-26 10:57:46.715 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: IDENT(client_file_ident=2, client_file_ident_salt=4308936264579674805, scan_server_version=0, scan_client_version=0, latest_server_version=0, latest_server_version_salt=0)
06-26 10:57:46.716 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: on_state_download_progress, downloaded = 0, downloadable(total) = 0, uploaded = 0, uploadable = 0, reliable_download_progress = 0, snapshot version = 0
06-26 10:57:46.716 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: MARK(request_ident=1)
06-26 10:57:46.928 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Received: DOWNLOAD(download_server_version=0, download_client_version=0, latest_server_version=0, latest_server_version_salt=0, upload_client_version=0, upload_server_version=0, downloadable_bytes=0, num_changesets=0, ...)
06-26 10:57:46.937 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 0, uploadable = 356, reliable_download_progress = 1, snapshot version = 4
06-26 10:57:47.137 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Received: MARK(request_ident=1)
06-26 10:57:47.137 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=4, progress_server_version=0, locked_server_version=0, num_changesets=1)
06-26 10:57:47.137 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Upload compaction: original size = 356, compacted size = 356
06-26 10:57:47.353 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Received: DOWNLOAD(download_server_version=1, download_client_version=3, latest_server_version=1, latest_server_version_salt=7234827468770884853, upload_client_version=4, upload_server_version=0, downloadable_bytes=0, num_changesets=0, ...)
06-26 10:57:47.367 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=5, progress_server_version=1, locked_server_version=1, num_changesets=0)
06-26 10:57:47.368 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 356, uploadable = 356, reliable_download_progress = 1, snapshot version = 5
06-26 10:58:28.933 9584-9668 E/REALM_SYNC: Connection[1]: Reading failed: End of input
06-26 10:58:28.933 9584-9668 I/REALM_SYNC: Connection[1]: Connection closed due to error
06-26 10:58:28.946 9584-9668 E/RealmSyncManager$getSyn: MISC_END_OF_INPUT(realm.util.misc_ext:1): End of input
        at io.realm.SyncSession.notifySessionError(SyncSession.java:240)
        at io.realm.SyncManager.notifyErrorHandler(SyncManager.java:526)
06-26 10:58:28.946 9584-9668 D/REALM_SYNC: Connection[1]: Resolving 'example-server.us1a.cloud.realm.io:443'
06-26 10:58:28.971 9584-9668 D/REALM_SYNC: Connection[1]: Connecting to endpoint '34.216.56.123:443' (1/3)
06-26 10:58:29.181 9584-9668 I/REALM_SYNC: Connection[1]: Connected to endpoint '34.216.56.123:443' (from '10.1.1.19:33743')
06-26 10:58:29.401 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:58:29.405 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:58:29.408 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:58:29.412 9584-9668 D/REALM_JNI: Callback to Java requesting certificate validation for host example-server.us1a.cloud.realm.io
06-26 10:58:29.689 9584-9668 D/REALM_SYNC: Connection[1]: WebSocket::initiate_client_handshake()
06-26 10:58:29.957 9584-9668 D/REALM_SYNC: Connection[1]: WebSocket::handle_http_response_received()
06-26 10:58:29.957 9584-9668 D/REALM_SYNC: Connection[1]: Negotiated protocol version: 30
06-26 10:58:29.957 9584-9668 D/REALM_SYNC: Connection[1]: Will emit a ping in 50876 milliseconds
06-26 10:58:29.958 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: BIND(path='/user-id/smarthome', signed_user_token_size=839, need_client_file_ident=0, is_subserver=0)
06-26 10:58:29.963 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Sending: CLIENT_VERSION_REQUEST(client_file_ident=2, client_file_ident_salt=4308936264579674805)
06-26 10:58:30.382 9584-9668 D/REALM_SYNC: Connection[1]: Session[1]: Received: CLIENT_VERSION(client_version=3)
06-26 10:58:30.382 9584-9668 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xe0 in tid 9668 (Thread-490)

Note that the package name, realm instance URL, class name, and IP address have been substituted with dummy values

Version of Realm and tooling

Realm version(s): 7.0.0

Realm Sync feature enabled: Yes

Android Studio version: 4.0

Android Build Tools version: 29.0.3

Gradle version: Gradle 6.1.1 used with Android Gradle Plugin 4.0.0

Which Android version and device(s): Android 5.1.1 running on TCL Xess P17AA tablet

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 29 (13 by maintainers)

Most upvoted comments

We have just released version 7.0.3 which includes more fixes regarding memory management. Please upgrade your dependencies and let us know if the problem is still present.

It has been fixed ! Tested right now. On 7.0.6 crash then on 7.0.7 no more crash. 👍 Thanks !

@VicMikhailau would you mind trying with version 7.0.4, we just released it today and it addresses further memory issues.

It was mostly an internal note. Realm shouldn’t crash like this, no matter what. So it is a bug on our end. Unfortunately, these kinds of bugs are really tricky to track down unless we can find a way to reproduce it.