nextcloud / Android-SingleSignOn

Single sign-on for Nextcloud (Android Library Project)
GNU General Public License v3.0
70 stars 30 forks source link

NextcloudApiNotRespondingException #162

Open David-Development opened 4 years ago

David-Development commented 4 years ago

By now two apps are having issues with the NextcloudApiNotRespondingException Bug.

A few days ago I was experiencing the same issue on my device (I think right after I updated the news app via the play store). Several restarts of the app did not help. Only setting up the account again solved the problem for me. Still not sure if the Nextcloud Files App has something to do with it or if the problem is on the "client" side. @stefan-niedermann Do you have new insights into why this error happens? Or any ideas if the files app is involved in this?

Maybe some old Service Connections are reused which are broken? But that wouldn't make sense in terms of the app restarts I performed. Maybe restarting the phone helps..? That would be interesting to find out.

Confirmed devices

Android Version Device Original issue Disable 🔋-Opt solved
Android 5.1 Nubia N1 https://github.com/stefan-niedermann/nextcloud-notes/issues/710#issuecomment-651054925 âś…
Android 6 / 8 Meizu M5s
Android 7 Huawei MediaPad T3 https://github.com/stefan-niedermann/nextcloud-notes/issues/907 âś… (clear storage after)
Android 10 Pixel 4 XL
Android 10 Xiaomi Mi 8
MiUI 12.5.1 Xiaomi Mi 10 Pro 5G https://github.com/stefan-niedermann/nextcloud-notes/issues/1312 :x:
stefan-niedermann commented 4 years ago

@tobiasKaminsky just said, this is reproducable when the files app is updated and SSO should recreate the API instance after a 5s timeout 🤷‍♂

David-Development commented 4 years ago

Okay, I tried reproducing the issue. I installed the news app and put it into debugging mode. I updated the nextcloud files app using the following command:

./adb install ~/Downloads/gplay-release-30100090.apk

As I would expect I was able to see the following in the LogCat:

2020-01-21 17:41:06.987 5245-5245/de.luhmer.owncloudnewsreader E/com.nextcloud.android.sso.api.AidlNetworkRequest: Nextcloud Single sign-on: ServiceDisconnected
2020-01-21 17:41:06.987 5245-5245/de.luhmer.owncloudnewsreader D/com.nextcloud.android.sso.api.AidlNetworkRequest: reconnecting lost SingleSignOn service connection
2020-01-21 17:41:06.987 5245-5245/de.luhmer.owncloudnewsreader V/com.nextcloud.android.sso.api.NetworkRequest: Nextcloud Single sign-on connect() called [main] Account-Type: [nextcloud]
2020-01-21 17:41:07.334 5245-5245/de.luhmer.owncloudnewsreader V/com.nextcloud.android.sso.api.AidlNetworkRequest: Nextcloud Single sign-on: onServiceConnected [main]

So the lost connection (due to the reinstall process) is re-established successfully. So at this point I'm not able to reproduce the issue. I'll need to investigate a little further..

teras commented 4 years ago

I've tried connecting with both, the "stable" version of NextCloud Files and the dev version, from the F-Droid repository, as well as the Google Play version. None worked properly. Is there any solution for this yet?

David-Development commented 4 years ago

@teras Unfortunately not. I'm on my way back from my vacation and hopefully I'll have some time in the next few days to investigate further. I didn't update my nextcloud files app on the phone yet so I am hoping to be able to reproduce the error and grab some logcat output from it. Like I said before manually reinstalling the files app using adb does not help much as everything works as expected during my tests (the api reconnects immediately).

Call for action: If anyone wants to help to investigate this issue, it would be very helpful to grab the logcat output (of both the nextcloud files app as well as the client app; e.g. nextcloud news / nextcloud notes) while updating the nextcloud files app trough the app store.

David-Development commented 4 years ago

Looks like I was able to fix this issue today. Planning on releasing a new version in the next couple days.

Reference: https://github.com/nextcloud/Android-SingleSignOn/pull/163

stefan-niedermann commented 4 years ago

Here we go again :(

SSO-Version 0.5.0-rc3

https://github.com/stefan-niedermann/nextcloud-notes/issues/752?notification_referrer_id=MDE4Ok5vdGlmaWNhdGlvblRocmVhZDczMjIzOTg2Mzo0NzQxMTk5

stefan-niedermann commented 4 years ago

Another one: https://github.com/stefan-niedermann/nextcloud-notes/issues/753#issuecomment-592944692

Though i find the different stack traces interesting. The first one looks like 5 retrys, the second one has only one entry.

stefan-niedermann commented 4 years ago

Another one with 2 stack traces:

https://github.com/stefan-niedermann/nextcloud-notes/issues/710#issuecomment-593069374

(If i receive another stacktrace i will merge all references to one comment to not flood this thread)

FredMa01 commented 4 years ago

uI am using these two apps : News 0.9.9.36 (https://f-droid.org/fr/packages/de.luhmer.owncloudnewsreader/) and Notes 2.10.3 (https://f-droid.org/fr/packages/it.niedermann.owncloud.notes/) with Nextcloud 18.0.1.3 News is ok Notes is ok one or two synchronisations and after I have issue with "NextcloudApiNotRespondingException"

> App Version: 2.10.3
> App Version Code: 81
> Files App Version Code: 30100190OS Version: 4.9.148(9.1.0.155C432)
> OS API Level: 28
> Device: HWLLD-H
> Model (and Product): LLD-L31 (LLD-L31)com.nextcloud.android.sso.exceptions.NextcloudApiNotRespondingException: L'application Nexcloud Files ne répond pas. Veuillez signaler ce problème.
> at com.nextcloud.android.sso.api.AidlNetworkRequest.waitForApi(AidlNetworkRequest.java:147)
> at com.nextcloud.android.sso.api.AidlNetworkRequest.performAidlNetworkRequestV2(AidlNetworkRequest.java:278)
> at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:165)
> at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:148)
> at it.niedermann.owncloud.notes.persistence.NotesClient.requestServer(NotesClient.java:163)
> at it.niedermann.owncloud.notes.persistence.NotesClient.putNote(NotesClient.java:107)
> at it.niedermann.owncloud.notes.persistence.NotesClient.editNote(NotesClient.java:122)
> at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.pushLocalChanges(NoteServerSyncHelper.java:347)
> at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:318)
> at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:284)
> at android.os.AsyncTask$2.call(AsyncTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:246)
> at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
> at java.lang.Thread.run(Thread.java:784)
> com.nextcloud.android.sso.exceptions.NextcloudApiNotRespondingException: L'application Nexcloud Files ne répond pas. Veuillez signaler ce problème.
> at com.nextcloud.android.sso.api.AidlNetworkRequest.waitForApi(AidlNetworkRequest.java:147)
> at com.nextcloud.android.sso.api.AidlNetworkRequest.performAidlNetworkRequestV2(AidlNetworkRequest.java:278)
> at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:165)
> at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:148)
> at it.niedermann.owncloud.notes.persistence.NotesClient.requestServer(NotesClient.java:163)
> at it.niedermann.owncloud.notes.persistence.NotesClient.getNotes(NotesClient.java:98)
> at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.pullRemoteChanges(NoteServerSyncHelper.java:413)
> at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:320)
> at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:284)
> at android.os.AsyncTask$2.call(AsyncTask.java:334)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:246)
> at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
> at java.lang.Thread.run(Thread.java:784)
PinkFreud commented 4 years ago

I'm seeing this issue as well:

App Version: 2.11.3
App Version Code: 2011003
Files App Version Code: 30100190

---

OS Version: 4.14.150-g05fe60fb845b-ab6126650(6156912)
OS API Level: 29
Device: coral
Model (and Product): Pixel 4 XL (coral)

---

com.nextcloud.android.sso.exceptions.NextcloudApiNotRespondingException: Nextcloud files app api is not responding. Please report this issue.
    at com.nextcloud.android.sso.api.AidlNetworkRequest.waitForApi(AidlNetworkRequest.java:147)
    at com.nextcloud.android.sso.api.AidlNetworkRequest.performAidlNetworkRequestV2(AidlNetworkRequest.java:278)
    at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:165)
    at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:148)
    at it.niedermann.owncloud.notes.persistence.NotesClient.requestServer(NotesClient.java:162)
    at it.niedermann.owncloud.notes.persistence.NotesClient.getNotes(NotesClient.java:98)
    at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.pullRemoteChanges(NoteServerSyncHelper.java:451)
    at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:358)
    at it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:320)
    at android.os.AsyncTask$3.call(AsyncTask.java:378)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
    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:919)
stefan-niedermann commented 4 years ago

And did you follow the steps we mentioned earlier in this thread @PinkFreud ?

Edit Sorry @PinkFreud i was in the wrong issue - Please read starting here: https://github.com/stefan-niedermann/nextcloud-notes/issues/752#issuecomment-605430344

TL;DR: Clear Storage of both apps, Notes and the main Nextcloud android app.

PinkFreud commented 4 years ago

And did you follow the steps we mentioned earlier in this thread @PinkFreud ?

Edit Sorry @PinkFreud i was in the wrong issue - Please read starting here: stefan-niedermann/nextcloud-notes#752 (comment)

TL;DR: Clear Storage of both apps, Notes and the main Nextcloud android app.

This was almost a month ago (sorry, I seem to have missed your reply, argh!), but I did manage to get it working. I don't recall what I did now, but I may very well have done that.

eyenalxai commented 4 years ago

Relevant closed Meizu issue: https://github.com/stefan-niedermann/nextcloud-notes/issues/753

I installed Notes and Deck apps for Android on Meizu M5s, and they both didn't work because of the NextcloudApiNotRespondingException error.

I fixed the issue by disabling Smart Background feature and allowing all Nextcloud related apps to run in the background.

Previously I tried clearing cache, storage and reinstalling apps multiple times without any positive results.

Logs are the same as above, so I won't provide them.

dasbiswajit commented 4 years ago

@David-Development Good Day! Count 3 apps now!! Nextcloud-bookmark I wished to integrate SSO with Nextcloud bookmark. the latest code is here. However, this is stopping me from releasing the fix for SSO. This feature is already live however this issue blocking SSO feature.

stefan-niedermann commented 4 years ago

For documentation @David-Development another one where disabling battery optimization worked as solution: https://github.com/stefan-niedermann/nextcloud-notes/issues/710#issuecomment-651054925

grinapo commented 3 years ago

Just reiterating what I said in stefan-niedermann/nextcloud-notes#1312

For me battery optim or autostart (or basically anything) haven't fixed it.

But scratching app storage did: Notes re-requested the NC account then re-pulled the data and now it works. However I have the suspicion that if I do not use the app for a while (weeks?) it will be stopped by the chinese communist party MIUI 12.5.1 and after that it will not be able to reconnect until another full data clear.