on ‎2015 Aug 26 11:57 AM
Hello experts,
I've faced this issue for a long time and I hope you guys could help me with this.
Sometimes when the sync is cancelled in the app an error of upload occurs, with the "invalid sync sequence ID" description in the server.
We've been using the SQLAnywhere 16 2127 and UltraliteJ for Android. The sync is canceled using the 'syncProgress' callback from 'SyncObserver' class.
Looking for evidences in the server log, I've noticed that the transaction of the canceled sync is commited, but after a bit of time a log of 'connection drop' is logged.
This error is a little bit hard to reproduce, but it affects hundred of users every week in my company.
After that, I'm only able to sync again with this user if I start a new sync with a new database.
Any suggestions of what could be happening?
I. 2015-08-26 11:06:49. <1084> Request from "UL 16.0.2127" for: remote ID: 2, user name: 24, version: XXX
I. 2015-08-26 11:06:49. <1084> The current synchronization is using a connection with connection ID 'SPID 262'
I. 2015-08-26 11:06:49. <1084> The authenticate_parameters script returned 1000
I. 2015-08-26 11:06:49. <1084> COMMIT Transaction: Authenticate user
I. 2015-08-26 11:06:49. <1084> COMMIT Transaction: Begin synchronization
I. 2015-08-26 11:06:49. <1084> COMMIT Transaction: Prepare for download
I. 2015-08-26 11:06:50. <1084> Sending the download to the remote database
I. 2015-08-26 11:06:50. <1084> COMMIT Transaction: Download
I. 2015-08-26 11:06:57. <1084> COMMIT Transaction: End synchronization
I. 2015-08-26 11:10:54. <1085> Request from "UL 16.0.2127" for: remote ID: 2, user name: 24, version: XXX
I. 2015-08-26 11:10:54. <1085> The current synchronization is using a connection with connection ID 'SPID 262'
I. 2015-08-26 11:10:54. <1085> The authenticate_parameters script returned 1000
I. 2015-08-26 11:10:54. <1085> COMMIT Transaction: Authenticate user
I. 2015-08-26 11:10:54. <1085> The sync sequence ID in the consolidated database: 66e705a64bc911e58000d4b26ffaac50; the remote previous sequence ID: ac77d1964bc811e58000d4b26ffaac50, and the current sequence ID: f8e572bc4bc911e580009bbc92b92a77
E. 2015-08-26 11:10:54. <1085> [-10400] Invalid sync sequence ID for remote ID '2'
I. 2015-08-26 11:10:54. <1085> Synchronization failed
E. 2015-08-26 11:10:59. <1084> [-10279] Connection was dropped due to lack of network activity
I. 2015-08-26 11:10:59. <1084> Synchronization complete
A new log with verbosity -vp
I. 2015-08-27 16:05:16. <38> Request from "UL 16.0.2127" for: remote ID: 2, user name: 24, version: XXX
I. 2015-08-27 16:05:16. <38> The current synchronization is using a connection with connection ID 'SPID 366'
I. 2015-08-27 16:05:16. <38> The authenticate_parameters script returned 1000
I. 2015-08-27 16:05:16. <38> COMMIT Transaction: Authenticate user
I. 2015-08-27 16:05:16. <38> Publication #1: ul_default_pub, subscription id: 1, last download time: 2015-08-27 16:05:06.727000
I. 2015-08-27 16:05:16. <38> The sync sequence ID in the consolidated database: 3c4236b04cbc11e58000c12fcb6170e4; the remote previous sequence ID: 3c4236b04cbc11e58000c12fcb6170e4, and the current sequence ID: 41d955e04cbc11e58000c12fcb6170e4
I. 2015-08-27 16:05:16. <38> Last upload time for subscription id 1: 2015-08-27 15:41:13.180000
I. 2015-08-27 16:05:16. <38> Generation number for publication 'ul_default_pub' is 1
I. 2015-08-27 16:05:16. <38> COMMIT Transaction: Begin synchronization
I. 2015-08-27 16:05:17. <38> COMMIT Transaction: Prepare for download
I. 2015-08-27 16:05:17. <38> Next last download timestamp fetched from the consolidated database is "2015-08-27 16:05:16.297000"
I. 2015-08-27 16:05:18. <38> Sending the download to the remote database
I. 2015-08-27 16:05:18. <38> COMMIT Transaction: Download
I. 2015-08-27 16:05:24. <38> COMMIT Transaction: End synchronization
I. 2015-08-27 16:06:13. <39> Request from "UL 16.0.2087" for: remote ID: 1009, user name: 17, version: XXX
I. 2015-08-27 16:06:13. <39> The current synchronization is using a connection with connection ID 'SPID 366'
I. 2015-08-27 16:06:13. <39> The authenticate_parameters script returned 1000
I. 2015-08-27 16:06:13. <39> COMMIT Transaction: Authenticate user
I. 2015-08-27 16:06:13. <39> Publication #1: ul_default_pub, subscription id: 1, last download time: 2015-08-27 16:04:35.817000
I. 2015-08-27 16:06:13. <39> The sync sequence ID in the consolidated database: 874340d9d4404fc995874938ed708bc5; the remote previous sequence ID: 874340d9d4404fc995874938ed708bc5, and the current sequence ID: 137635d70da644e089e8e42c3ab092cb
I. 2015-08-27 16:06:13. <40> Request from "UL 16.0.2127" for: remote ID: 2, user name: 24, version: XXX
I. 2015-08-27 16:06:13. <40> The current synchronization is using a connection with connection ID 'SPID 357'
I. 2015-08-27 16:06:13. <40> The authenticate_parameters script returned 1000
I. 2015-08-27 16:06:13. <40> COMMIT Transaction: Authenticate user
I. 2015-08-27 16:06:13. <40> Publication #1: ul_default_pub, subscription id: 1, last download time: 2015-08-27 16:05:06.727000
I. 2015-08-27 16:06:13. <40> The sync sequence ID in the consolidated database: 41d955e04cbc11e58000c12fcb6170e4; the remote previous sequence ID: 3c4236b04cbc11e58000c12fcb6170e4, and the current sequence ID: 64255a684cbc11e58000d4570e72fa59
E. 2015-08-27 16:06:13. <40> [-10400] Invalid sync sequence ID for remote ID '2'
I. 2015-08-27 16:06:14. <40> Synchronization failed
A new log with download/upload scenario:
I. 2015-07-31 05:44:16. <1361> Request from "UL 16.0.2087" for: remote ID: 190, user name: 99, version: XXX
I. 2015-07-31 05:44:16. <1361> The current synchronization is using a connection with connection ID 'SPID 110'
I. 2015-07-31 05:44:16. <1361> The authenticate_parameters script returned 1000
I. 2015-07-31 05:44:16. <1361> COMMIT Transaction: Authenticate user
I. 2015-07-31 05:44:16. <1361> COMMIT Transaction: Begin synchronization
I. 2015-07-31 05:44:16. <1361> COMMIT Transaction: Upload
I. 2015-07-31 05:44:17. <1361> COMMIT Transaction: Prepare for download
I. 2015-07-31 05:44:28. <1361> Sending the download to the remote database
I. 2015-07-31 05:44:30. <1361> COMMIT Transaction: Download
I. 2015-07-31 05:44:31. <1362> Request from "UL 16.0.2087" for: remote ID: 190, user name: 99, version: XXX
E. 2015-07-31 05:44:31. <1362> [-10341] The remote database identified by remote ID '190' may already be synchronizing: unable to lock that remote ID
I. 2015-07-31 05:44:32. <1363> Request from "UL 16.0.2087" for: remote ID: 190, user name: 99, version: XXX
E. 2015-07-31 05:44:32. <1363> [-10341] The remote database identified by remote ID '190' may already be synchronizing: unable to lock that remote ID
I. 2015-07-31 05:44:33. <1363> The current synchronization is using a connection with connection ID 'SPID 112'
I. 2015-07-31 05:44:33. <1363> The authenticate_parameters script returned 1000
I. 2015-07-31 05:44:33. <1363> COMMIT Transaction: Authenticate user
E. 2015-07-31 05:44:33. <1363> [-10341] The remote database identified by remote ID '190' may already be synchronizing: unable to lock that remote ID
I. 2015-07-31 05:44:33. <1363> Synchronization failed
I. 2015-07-31 05:44:37. <1361> COMMIT Transaction: End synchronization
I. 2015-07-31 05:45:25. <1364> Request from "UL 16.0.2087" for: remote ID: 190, user name: 99, version: XXX
I. 2015-07-31 05:45:25. <1364> The current synchronization is using a connection with connection ID 'SPID 110'
I. 2015-07-31 05:45:25. <1364> The authenticate_parameters script returned 1000
I. 2015-07-31 05:45:25. <1364> COMMIT Transaction: Authenticate user
I. 2015-07-31 05:45:25. <1364> The sync sequence ID in the consolidated database: e41b0e0add35460091ca651ce0ee2633; the remote previous sequence ID: 25acf6af47234c1192f7203343b5e93e, and the current sequence ID: 1c20ad4023d44353a7b32d021c698c74
E. 2015-07-31 05:45:25. <1364> [-10400] Invalid sync sequence ID for remote ID '190'
I. 2015-07-31 05:45:26. <1364> Synchronization failed
E. 2015-07-31 05:48:26. <1361> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-31 05:48:26. <1361> Synchronization complete
And a very complex scenario which I couldn't figure out what could be happening? Maybe a simultaneos sync in the same device?
I. 2015-07-29 08:07:32. <1112> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:07:46. <1113> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:07:46. <1113> The current synchronization is using a connection with connection ID 'SPID 91'
I. 2015-07-29 08:07:46. <1113> The authenticate_parameters script returned 1000
I. 2015-07-29 08:07:46. <1113> COMMIT Transaction: Authenticate user
I. 2015-07-29 08:07:46. <1113> COMMIT Transaction: Begin synchronization
I. 2015-07-29 08:07:46. <1113> COMMIT Transaction: Upload
I. 2015-07-29 08:07:48. <1113> COMMIT Transaction: Prepare for download
I. 2015-07-29 08:07:58. <1113> Sending the download to the remote database
I. 2015-07-29 08:08:00. <1113> COMMIT Transaction: Download
I. 2015-07-29 08:08:08. <1113> COMMIT Transaction: End synchronization
I. 2015-07-29 08:08:12. <1114> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:08:12. <1114> The current synchronization is using a connection with connection ID 'SPID 91'
I. 2015-07-29 08:08:12. <1114> The authenticate_parameters script returned 1000
I. 2015-07-29 08:08:12. <1114> COMMIT Transaction: Authenticate user
I. 2015-07-29 08:08:12. <1114> COMMIT Transaction: Begin synchronization
I. 2015-07-29 08:08:12. <1114> COMMIT Transaction: Upload
I. 2015-07-29 08:08:13. <1114> COMMIT Transaction: Prepare for download
I. 2015-07-29 08:08:21. <1115> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:08:21. <1115> The current synchronization is using a connection with connection ID 'SPID 82'
I. 2015-07-29 08:08:21. <1115> The authenticate_parameters script returned 1000
I. 2015-07-29 08:08:21. <1115> COMMIT Transaction: Authenticate user
E. 2015-07-29 08:08:21. <1115> [-10341] The remote database identified by remote ID '170' may already be synchronizing: unable to lock that remote ID
I. 2015-07-29 08:08:21. <1115> Synchronization failed
I. 2015-07-29 08:08:22. <1114> Sending the download to the remote database
I. 2015-07-29 08:08:25. <1114> COMMIT Transaction: Download
I. 2015-07-29 08:08:33. <1114> COMMIT Transaction: End synchronization
I. 2015-07-29 08:08:40. <1116> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:08:40. <1116> The current synchronization is using a connection with connection ID 'SPID 91'
I. 2015-07-29 08:08:40. <1116> The authenticate_parameters script returned 1000
I. 2015-07-29 08:08:40. <1116> COMMIT Transaction: Authenticate user
I. 2015-07-29 08:08:41. <1116> COMMIT Transaction: Begin synchronization
I. 2015-07-29 08:08:41. <1116> COMMIT Transaction: Upload
I. 2015-07-29 08:08:42. <1116> COMMIT Transaction: Prepare for download
I. 2015-07-29 08:08:48. <1117> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:08:48. <1117> The current synchronization is using a connection with connection ID 'SPID 82'
I. 2015-07-29 08:08:48. <1117> The authenticate_parameters script returned 1000
I. 2015-07-29 08:08:48. <1117> COMMIT Transaction: Authenticate user
E. 2015-07-29 08:08:48. <1117> [-10341] The remote database identified by remote ID '170' may already be synchronizing: unable to lock that remote ID
I. 2015-07-29 08:08:48. <1117> Synchronization failed
I. 2015-07-29 08:08:52. <1116> Sending the download to the remote database
I. 2015-07-29 08:08:54. <1116> COMMIT Transaction: Download
I. 2015-07-29 08:09:02. <1116> COMMIT Transaction: End synchronization
I. 2015-07-29 08:09:13. <1118> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:09:13. <1118> The current synchronization is using a connection with connection ID 'SPID 91'
I. 2015-07-29 08:09:13. <1118> The authenticate_parameters script returned 1000
I. 2015-07-29 08:09:13. <1118> COMMIT Transaction: Authenticate user
I. 2015-07-29 08:09:13. <1118> COMMIT Transaction: Begin synchronization
I. 2015-07-29 08:09:13. <1118> COMMIT Transaction: Upload
I. 2015-07-29 08:09:15. <1118> COMMIT Transaction: Prepare for download
I. 2015-07-29 08:09:20. <1119> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:09:20. <1119> The current synchronization is using a connection with connection ID 'SPID 82'
I. 2015-07-29 08:09:20. <1119> The authenticate_parameters script returned 1000
I. 2015-07-29 08:09:20. <1119> COMMIT Transaction: Authenticate user
E. 2015-07-29 08:09:20. <1119> [-10341] The remote database identified by remote ID '170' may already be synchronizing: unable to lock that remote ID
I. 2015-07-29 08:09:20. <1119> Synchronization failed
I. 2015-07-29 08:09:25. <1118> Sending the download to the remote database
I. 2015-07-29 08:09:27. <1118> COMMIT Transaction: Download
I. 2015-07-29 08:09:27. <1120> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:09:27. <1120> The current synchronization is using a connection with connection ID 'SPID 82'
I. 2015-07-29 08:09:27. <1120> The authenticate_parameters script returned 1000
I. 2015-07-29 08:09:27. <1120> COMMIT Transaction: Authenticate user
E. 2015-07-29 08:09:27. <1120> [-10341] The remote database identified by remote ID '170' may already be synchronizing: unable to lock that remote ID
I. 2015-07-29 08:09:33. <1121> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
E. 2015-07-29 08:09:33. <1121> [-10341] The remote database identified by remote ID '170' may already be synchronizing: unable to lock that remote ID
I. 2015-07-29 08:09:33. <1121> The current synchronization is using a connection with connection ID 'SPID 82'
I. 2015-07-29 08:09:33. <1121> The authenticate_parameters script returned 1000
I. 2015-07-29 08:09:33. <1121> COMMIT Transaction: Authenticate user
E. 2015-07-29 08:09:33. <1121> [-10341] The remote database identified by remote ID '170' may already be synchronizing: unable to lock that remote ID
I. 2015-07-29 08:09:35. <1118> COMMIT Transaction: End synchronization
I. 2015-07-29 08:09:39. <1122> Request from "UL 16.0.2087" for: remote ID: 170, user name: 11, version: XXX
I. 2015-07-29 08:09:39. <1122> The sync sequence ID in the consolidated database: 8064c8e9c74d496daacfc651456dbece; the remote previous sequence ID: 3a1fe564a0eb4d0b808709e078925e3b, and the current sequence ID: 7f42f25b36854bacb328cacb822bd6fc
E. 2015-07-29 08:09:39. <1122> [-10400] Invalid sync sequence ID for remote ID '170'
I. 2015-07-29 08:09:39. <1122> Synchronization failed
E. 2015-07-29 08:11:36. <1112> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-29 08:11:36. <1112> Synchronization complete
E. 2015-07-29 08:12:00. <1113> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-29 08:12:00. <1113> Synchronization complete
E. 2015-07-29 08:12:20. <1114> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-29 08:12:20. <1114> Synchronization complete
E. 2015-07-29 08:12:47. <1116> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-29 08:12:47. <1116> Synchronization complete
E. 2015-07-29 08:13:18. <1118> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-29 08:13:18. <1118> Synchronization complete
E. 2015-07-29 08:13:32. <1120> [-10279] Connection was dropped due to lack of network activity
I. 2015-07-29 08:13:32. <1120> Synchronization failed
Request clarification before answering.
This could happen if remote database IDs are not unique. I notice that the remote ID is '2' rather than a UUID (which is the default). Since you are using non-default remote IDs, I suspect this is the cause of the problem.
Further evidence of non-unique remote IDs is found in the sequence IDs. Since they are V1 UUIDs, the last 12 hex digits are a "node id" (often the network interface MAC address); the consolidated sequence ID and previous remote sequence ID came from node id d4b26ffaac50, whereas the current sequence ID came from node id 9bbc92b92a77.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is worth investigating whether the remote database IDs are unique.
Just a clarification for UltraLite on Android. The node id's are not MAC addresses - they are generated based on system time and randomness among other things. A node id for a given device will very likely be different after an application restart. It will stay constant for the in-memory life cycle of the application though.
The remote database IDs are unique, for sure. In fact, I could reproduce this scenario with one single device syncing in a environment with only one user. About the node id, I've restarted my application after the cancelation (in fact, the sync is canceled prior the application closing), which can be the cause of the generation of two different "node ids", as Andy explained. Maybe the Mobilink is accepting a new request before closing the resources from the last one which can be leading to a bug.
Thanks Andy. In other words, the Android device would have to have be rebooted, or the application closed, cleared from memory, and then restarted, for there to be two different "node ids" from the same remote. In this case, that would have to be between 11:06:50 and 11:10:54. If that didn't happen, then it seems two remote databases have the remote ID of '2'. Remote IDs must be unique!
Did you see different "node ids" (in the sequence IDs) after restarting the application? Normally an Android app stays in memory after closing, which is what Andy meant by "in-memory life cycle of the application".
(A different "node id" in sequence IDs isn't a problem for MobiLink. It just seemed like evidence of non-unique remote IDs.)
A new request from the same remote ID kicks out an in-progress sync, but it may be that your application is not handling failed downloads correctly.
The application doesn't stay in memory because we force kill the process. I've made some tests and the node id do change if I restart the application. About the remote IDs, they are assigned at the moment of the first application run, server-side, stored in a identity database column. We don't have any evidences of duplicated remote IDs so far.
About the download error handling, I'm not sure what it is. Since we cancel the sync using the Ultralite callbacks and, after the Ultralite return (which its thread has been locked during the synchronize method call) we kill the process. So, where am I supposed to handle the download failure if I want to abort the process?
You shouldn't need to kill the process to cancel the sync! I think you just need to return True from SyncObserver.syncProgress. These posts might help:
http://sqlanywhere-forum.sap.com/questions/8110/mobilink-synchronization-with-progress-bar-in-ultral...
http://sqlanywhere-forum.sap.com/questions/10734/mobilink-connection-timeout
A partial download should be automatically rolled back as long as you have not enabled the Keep partial download synchronization parameter. But killing the process may cause problems with rollback.
The reason we want to see -vp verbosity is to make sure that your application is doing a "check status" sync after a failed download (if not keeping partial downloads) or a "resume" sync (if keeping partial downloads).
I'm not killing the process because the sync. I'm canceling the sync to kill the process for other reasons. I've checked here and we don't use partial downloads, since we have such a complex download preparation logics which don't fit to this feature. I couldn't reproduce the error yet (it is hard to reproduce), but as soon as I do it I update the question with this information. Thanks again!
My concern was that the force kill of the process may interfere with proper clean up of the cancelled sync, eg. if it is killed after UltraLite returns, but Android may still be flushing to persistent storage, such as an SD card.
(BTW the box with an arrow on a comment is for replying to that comment.)
We have a retry logic for checking sync status, if the ODBC driver returns a timeout ODBC state when the MobiLink server was not able to lock the remote ID. This logic seems working well with a Microsoft SQL Server. However, we did not see this retry logic shown in your MobiLink server log file. So I was wondering if you could tell us what kind of consolidated database servers you are current using?
Thanks! Hopefully, there are no other problems, because Microsoft SQL server 2014 is not officially supported by the MobiLink Server 16.0. I have two more questions: 1) the ODBC driver version; and 2) The MobiLink server command line options (Please don't let me your -c setting). Could you please give us this information?
We are not able to reproduce the problem you have seen, because the MobiLink server always retried on status check with our tests until it was able to lock the remote ID. Could you please let us know your database options? You can get the options by issuing the following query against your SQL Server database: select * from sys.databases where name = 'your_sql_server_database_name'
Please give us the query result set including the column names, so that we can compare your options with ours.
The properties that were not here are null
"compatibility_level": "120", "collation_name": "Latin1_General_CI_AS", "user_access": "0", "user_access_desc": "MULTI_USER", "is_read_only": "0", "is_auto_close_on": "0", "is_auto_shrink_on": "0", "state": "0", "state_desc": "ONLINE", "is_in_standby": "0", "is_cleanly_shutdown": "0", "is_supplemental_logging_enabled": "0", "snapshot_isolation_state": "0", "snapshot_isolation_state_desc": "OFF", "is_read_committed_snapshot_on": "0", "recovery_model": "3", "recovery_model_desc": "SIMPLE", "page_verify_option": "2", "page_verify_option_desc": "CHECKSUM", "is_auto_create_stats_on": "1", "is_auto_create_stats_incremental_on": "0", "is_auto_update_stats_on": "1", "is_auto_update_stats_async_on": "0", "is_ansi_null_default_on": "0", "is_ansi_nulls_on": "0", "is_ansi_padding_on": "0", "is_ansi_warnings_on": "0", "is_arithabort_on": "0", "is_concat_null_yields_null_on": "0", "is_numeric_roundabort_on": "0", "is_quoted_identifier_on": "0", "is_recursive_triggers_on": "0", "is_cursor_close_on_commit_on": "0", "is_local_cursor_default": "0", "is_fulltext_enabled": "1", "is_trustworthy_on": "0", "is_db_chaining_on": "0", "is_parameterization_forced": "0"
Your database setting is slightly different than ours. However, we are still not able to reproduce this problem, even after we reconfigured our SQL Server database setting to match yours, the MobiLink server always keeps retry on sync status, when there is a problem on lock remote ID locking. However, we have found a problem within the MobiLink server, if the retry logic does not work for sync status check. This problem will be fixed as soon as we can. To workaround this problem, please try to reduce the sync frequency for individual remotes whose last sync status was unknown. By the way, what are the OS type and OS version you are currently running your MobiLink server?
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.