element-hq / element-hq/element-android

Endless loop in SyncThread if network connection is lost during sync

Open
#1,947 1 comment 0 reactions 1 assignee Claimed by @ganfra View on GitHub
A-Sync T-Defect
Dominant language
Kotlin
Stars
3.7k
Forks
917
Avg merge
8d 20h
Merged PRs (30d)
1

Description

**Describe the bug**
When the network connection is lost during sync there's an endless loop in `SyncThread`. In this case the sync is retried until a connection is available again. See
https://github.com/vector-im/element-android/blob/1b9b18851d2389e41268a56229b8097e663c10b2/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt#L129
and following lines.

This leads to an endless loop if the network connection is explicitly dropped or a network connection is not possible for other reasons for a longer time. This unnecessary increases the battery usage #536.

**To Reproduce**
Steps to reproduce the behavior:
1. Drop network connection during sync.

**Expected behavior**
The sync should immediately stop if the connection is dropped explicitly (if this can be checked through the Android API) and stop after a few retries. Maybe it makes sense to combine it with an increasing retry delay.

**Smartphone (please complete the following information):**
- Device: Samsung S5
- OS: Android 9 (Lineage OS 16.0)

**Additional context**
- develop branch at 1b9b188 with fdroid flavor
- Homeserver: matrix.org

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.