API Does Not Give Out Items List of Module - eWay-CRM Mobile is Stucked in Initial Synchronization

Description

eWay-CRM Mobile repeats initial synchronization from specific point. Application may finish synchronization of one module, but cannot load other. The one that cannot be loaded is one with a lot of records (e.g. Journal module).

The synchronization error is logged in the error log on eWay-CRM Mobile.

The main part of the error in Android log is:

Caused by: java.net.ConnectException: The WCF is not responding properly on method 'GetWorkflowModelsByItemGuids'. Status code: -1, status message: 'IO exception while loading from WCF: recvfrom failed: ECONNRESET (Connection reset by peer)'
    at com.eway_crm.core.client.WcfConnection.callMethod(WcfConnection.java:472)
    at com.eway_crm.core.datainterfaces.WcfRemoteItemStore.getModels(WcfRemoteItemStore.java:866)
    ... 9 more

The whole error may look like this:

2017-11-16 09:42:20 com.eway_crm.mobile.androidapp.sync.exceptions.SynchronizationException: Loading block of items failed due to the remote store error.
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread$BlockLoader.loadAndSave(SynchronizationThread.java:1115)
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread.syncItems(SynchronizationThread.java:861)
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread.syncAllModuleItems(SynchronizationThread.java:726)
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread.runFullSync(SynchronizationThread.java:555)
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread.run(SynchronizationThread.java:222)
    at com.eway_crm.mobile.androidapp.sync.WcfSyncAdapter.onPerformSync(WcfSyncAdapter.java:118)
    at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
Caused by: com.eway_crm.core.datainterfaces.exceptions.RemoteStoreException: Connection error while using the remote store.
    at com.eway_crm.core.datainterfaces.WcfRemoteItemStore.getModels(WcfRemoteItemStore.java:869)
    at com.eway_crm.mobile.androidapp.sync.modules.ModelsSynchronizedModule.getItems(ModelsSynchronizedModule.java:59)
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread$3.loadItems(SynchronizationThread.java:732)
    at com.eway_crm.mobile.androidapp.sync.SynchronizationThread$BlockLoader.loadAndSave(SynchronizationThread.java:1112)
    ... 6 more
Caused by: java.net.ConnectException: The WCF is not responding properly on method 'GetWorkflowModelsByItemGuids'. Status code: -1, status message: 'IO exception while loading from WCF: recvfrom failed: ECONNRESET (Connection reset by peer)'
    at com.eway_crm.core.client.WcfConnection.callMethod(WcfConnection.java:472)
    at com.eway_crm.core.datainterfaces.WcfRemoteItemStore.getModels(WcfRemoteItemStore.java:866)
    ... 9 more

iPhone log contains error like this (iOS evaluates sudden end of TCP communication as a loss of network:

[ERROR] [BACK] [2017-11-16 09:59:50] Sync error: Unable to get all items identifiers of module EnumValues due to the remote store error: Connection error while using the remote store. More: The WCF is not responding properly. Status code: 'Optional(-2))', status message: 'Optional("Network connection lost.")'.

Version

All versions of eWay-CRM

Difficulty

High

Resolution

WCF service on IIS has limits for request, buffer, response and serializer. The list is here: http://geekswithblogs.net/mnf/archive/2013/06/02/response-for-rest-method-was-truncated-because-default-maxitemsinobjectgraph-was.aspx

eWay-CRM increases some limits automatically. But the issue can be caused by the number of objects in the graph that is serialized or deserialized for JSON. It should be configured in Web.config file of WCF service like this:

<behavior name="webBehaviour">
    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>

Default settings should be fine, new versions of Windows Serviers, IIS and .NET can take hundreds of thousands items without limit. The solution is for older versions of OS, IIS and .NET.