owncloud / owncloud/android

[BUG] Can't login always keep me back to "Server Address" page

Open
#4,159 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs info
Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Description

Actual behaviour

-I can't login, it keeps sending me back to page which asking me Server address.

Expected behaviour

-let me open my cloud

Steps to reproduce
  1. Insert server adress
  2. Insert username and password
  3. Automatically send me back to server adress

Can this problem be reproduced with the official owncloud server?
(url: https://demo.owncloud.org, user: test, password: test)
Yes

Environment data

Android version: Android 11

Device model: Redmi 8

Stock or customized system: Custom ROM

ownCloud app version: 4.1.0

ownCloud server version:

Logs
Web server error log
Insert your webserver log here
ownCloud log (data/owncloud.log)
Error:
Error inserting _id=5 name=MyUsername@myselfhostap.net/cloud type=owncloud last_password_entry_time_millis_epoch=1695032940067
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: accounts._id (code 1555 SQLITE_CONSTRAINT_PRIMARYKEY)
	at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
	at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:938)
	at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
	at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1701)
	at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1570)
	at com.android.server.accounts.AccountsDb.insertDeAccount(AccountsDb.java:856)
	at com.android.server.accounts.AccountManagerService.addAccountInternal(AccountManagerService.java:1831)
	at com.android.server.accounts.AccountManagerService.addAccountExplicitlyWithVisibility(AccountManagerService.java:484)
	at com.android.server.accounts.AccountManagerService.addAccountExplicitly(AccountManagerService.java:1649)
	at android.accounts.IAccountManager$Stub.onTransact(IAccountManager.java:579)
	at com.android.server.accounts.AccountManagerService.onTransact(AccountManagerService.java:1074)
	at android.os.Binder.execTransactInternal(Binder.java:1154)
	at android.os.Binder.execTransact(Binder.java:1failed

Warning:
insertAccountIntoDatabase: Account {name=xxxx@xxxx.xxxxxxxx.xxx, type=owncloud}, skipping the DB insert failed

Error:
Work [ id=1efa3916-d5f9-4d1c-9327-6674e808535b, tags={ com.owncloud.android.workers.AccountDiscoveryWorker, MyUsername@myselfhostap.net/cloud  } ] failed because it threw an exception/error
java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.accounts.Account.name' on a null object reference
	at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:516)
	at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
	at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:317)
	at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.accounts.Account.name' on a null object reference
	at com.owncloud.android.workers.AccountDiscoveryWorker.doWork(AccountDiscoveryWorker.kt:58)
	at androidx.work.CoroutineWorker$startWork$1.invokeSuspend(CoroutineWorker.kt:68)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the login flow on Android 11 with ownCloud app 4.1.0, then inspect AccountDiscoveryWorker.kt at line 58 and the Android account insertion errors in the log. Trace why the account lookup is null after the UNIQUE constraint failure. Done means the supplied server and credentials open the cloud without returning to the Server Address page.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.