Realm Failing to Download

I am currently having a problem where none of my Realms can download the latest changes. This is affecting all of my users. Executing the following code results in a timeout exception after 300 seconds;

private static async Task<bool> SynchroniseRealm(Realm realm, string driverName, bool upload, bool download, ProcessResult processResult, List<ProcessLog> processLogs)
{
	string task = string.Empty;
	bool synchronised = false;
	var sw = new Stopwatch();
	sw.Start();

	try
	{
		var session = realm.GetSession();
		Thread.Sleep(250);

		using (var cts = new CancellationTokenSource())
		{
			cts.CancelAfter(TimeSpan.FromSeconds(_realmTimeout));

			if (upload)
			{
				task = "Upload";
				await SynchroniseRealmData(session, download).CancelAfter(cts.Token).ConfigureAwait(true);
			}

			if (download)
			{
				task = "Download";
				await SynchroniseRealmData(session, download).CancelAfter(cts.Token).ConfigureAwait(true);
			}
		}

		synchronised = true;
	}

	catch (OperationCanceledException ex)
	{
		string msg = $"{task} for {driverName} failed to complete within {_realmTimeout} seconds.\nError: {ex.GetFullMessage()}";
		Service.LogEntry(EventLogEntryType.Error, msg);
		var processLog = new ProcessLog(processResult.ProcessId, processResult.DriverId, EventLogEntryType.Error, nameof(UpdateRealmData), nameof(SynchroniseRealm), msg, ex.StackTrace.HasValue() ? ex.StackTrace : null);
		processLogs.Add(processLog);
		_restartService = true;
	}

	catch (Exception ex)
	{
		Service.LogException(new CrsException(nameof(UpdateRealmData), nameof(SynchroniseRealm), ex.GetFullMessage()));
		var processLog = new ProcessLog(processResult.ProcessId, processResult.DriverId, EventLogEntryType.Error, nameof(UpdateRealmData), nameof(SynchroniseRealm), ex.Message, ex.StackTrace.HasValue() ? ex.StackTrace : null);
		processLogs.Add(processLog);
	}

	finally
	{
		lock (appLock)
		{
			processResult.RealmSynchronised += sw.Elapsed;
		}
	}

	return synchronised;
}

private static async Task SynchroniseRealmData(Session session, bool download)
{
	if (download)
		await session.WaitForDownloadAsync().ConfigureAwait(true);
	else
		await session.WaitForUploadAsync().ConfigureAwait(true);
}

Hi @Raymond_Brack,

I suggest contacting MongoDB Cloud Support for help investigating this issue. It sounds like this code was previously working so perhaps there is an operational issue with your cloud service.

When you contact support, it would be helpful to provide the version of Realm SDK and cloud service that you are using (Realm Legacy Cloud or MongoDB Realm) to assist with investigation.

Regards,
Stennie