Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Crash when the token is expired #4116

Closed
Aitorbp opened this issue Aug 1, 2023 · 2 comments · Fixed by #4132
Closed

[BUG] Crash when the token is expired #4116

Aitorbp opened this issue Aug 1, 2023 · 2 comments · Fixed by #4132
Assignees
Labels
Crash Estimation - 3 (M) p2-high Escalation, on top of current planning, release blocker Type:bug
Milestone

Comments

@Aitorbp
Copy link
Collaborator

Aitorbp commented Aug 1, 2023

Actual behaviour

  • When the token is expired and you change list view for grid view the app crash. It could happen too when user change the screen. To fix that you have to click on Sign in and start log in process again. After that everything works good.

Expected behaviour

  • It shouldn´t be any crash when the token is expired. The server should generate a new one.

Steps to reproduce

  1. Wait until appear the dialog where say: The token is expired. Sign in.
  2. Click on grid view.
  3. The crash should appear.

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

Environment data

Android version:

Device model: Pixel A3 API 34 (Emulator)

Stock or customized system:

ownCloud app version: Owncloud debbug version 4.0

ownCloud server version:

Logs

2023-08-01 10:53:15.099 20295-20310 (TokenRequ...77) .run() com.owncloud.android.debug           E  Failed response while getting tokens from the server status code: 400; response message: {
                                                                                                      "error": "invalid_request",
                                                                                                      "error_description": "crypto/rsa: verification error"
                                                                                                    }
2023-08-01 10:53:15.100 20295-20310 (RemoteOpe... .<init>() com.owncloud.android.debug           D  RemoteOperationResult has processed UNHANDLED_HTTP_CODE: 400 Bad Request
2023-08-01 10:53:15.102 20295-20310 (TokenRequ...82) .run() com.owncloud.android.debug           E  Exception while getting tokens
                                                                                                    java.lang.IllegalStateException: closed
                                                                                                        at okio.RealBufferedSource.select(RealBufferedSource.kt:218)
                                                                                                        at okhttp3.internal.Util.readBomAsCharset(Util.kt:265)
                                                                                                        at okhttp3.ResponseBody.string(ResponseBody.kt:187)
                                                                                                        at com.owncloud.android.lib.common.http.methods.HttpBaseMethod.getResponseBodyAsString(HttpBaseMethod.kt:138)
                                                                                                        at com.owncloud.android.lib.common.operations.RemoteOperationResult.<init>(RemoteOperationResult.java:197)
                                                                                                        at com.owncloud.android.lib.resources.oauth.TokenRequestRemoteOperation.run(TokenRequestRemoteOperation.kt:78)
                                                                                                        at com.owncloud.android.lib.common.operations.RemoteOperation.runOperation(RemoteOperation.java:264)
                                                                                                        at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:229)
                                                                                                        at com.owncloud.android.lib.resources.oauth.services.implementation.OCOIDCService.performTokenRequest(OCOIDCService.kt:49)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource$performTokenRequest$tokenResponse$1.invoke(OCRemoteOAuthDataSource.kt:58)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource$performTokenRequest$tokenResponse$1.invoke(OCRemoteOAuthDataSource.kt:57)
                                                                                                        at com.owncloud.android.data.RemoteOperationHandlerKt.executeRemoteOperation(RemoteOperationHandler.kt:79)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource.performTokenRequest(OCRemoteOAuthDataSource.kt:57)
                                                                                                        at com.owncloud.android.data.oauth.repository.OCOAuthRepository.performTokenRequest(OCOAuthRepository.kt:38)
                                                                                                        at com.owncloud.android.domain.authentication.oauth.RequestTokenUseCase.run(RequestTokenUseCase.kt:30)
                                                                                                        at com.owncloud.android.domain.authentication.oauth.RequestTokenUseCase.run(RequestTokenUseCase.kt:25)
                                                                                                        at com.owncloud.android.domain.BaseUseCaseWithResult.execute(BaseUseCaseWithResult.kt:30)
                                                                                                        at com.owncloud.android.presentation.authentication.AccountAuthenticator.refreshToken(AccountAuthenticator.java:383)
                                                                                                        at com.owncloud.android.presentation.authentication.AccountAuthenticator.getAuthToken(AccountAuthenticator.java:177)
                                                                                                        at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:251)
                                                                                                        at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:253)
                                                                                                        at android.os.Binder.execTransactInternal(Binder.java:1344)
                                                                                                        at android.os.Binder.execTransact(Binder.java:1275)
2023-08-01 10:53:15.109 20295-20310 (RemoteOpe... .<init>() com.owncloud.android.debug           E  ---------------------------------
                                                                                                    Create RemoteOperationResult from exception.
                                                                                                     Message: IllegalStateException: closed
                                                                                                     Stacktrace: java.lang.IllegalStateException: closed
                                                                                                        at okio.RealBufferedSource.select(RealBufferedSource.kt:218)
                                                                                                        at okhttp3.internal.Util.readBomAsCharset(Util.kt:265)
                                                                                                        at okhttp3.ResponseBody.string(ResponseBody.kt:187)
                                                                                                        at com.owncloud.android.lib.common.http.methods.HttpBaseMethod.getResponseBodyAsString(HttpBaseMethod.kt:138)
                                                                                                        at com.owncloud.android.lib.common.operations.RemoteOperationResult.<init>(RemoteOperationResult.java:197)
                                                                                                        at com.owncloud.android.lib.resources.oauth.TokenRequestRemoteOperation.run(TokenRequestRemoteOperation.kt:78)
                                                                                                        at com.owncloud.android.lib.common.operations.RemoteOperation.runOperation(RemoteOperation.java:264)
                                                                                                        at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:229)
                                                                                                        at com.owncloud.android.lib.resources.oauth.services.implementation.OCOIDCService.performTokenRequest(OCOIDCService.kt:49)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource$performTokenRequest$tokenResponse$1.invoke(OCRemoteOAuthDataSource.kt:58)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource$performTokenRequest$tokenResponse$1.invoke(OCRemoteOAuthDataSource.kt:57)
                                                                                                        at com.owncloud.android.data.RemoteOperationHandlerKt.executeRemoteOperation(RemoteOperationHandler.kt:79)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource.performTokenRequest(OCRemoteOAuthDataSource.kt:57)
                                                                                                        at com.owncloud.android.data.oauth.repository.OCOAuthRepository.performTokenRequest(OCOAuthRepository.kt:38)
                                                                                                        at com.owncloud.android.domain.authentication.oauth.RequestTokenUseCase.run(RequestTokenUseCase.kt:30)
                                                                                                        at com.owncloud.android.domain.authentication.oauth.RequestTokenUseCase.run(RequestTokenUseCase.kt:25)
                                                                                                        at com.owncloud.android.domain.BaseUseCaseWithResult.execute(BaseUseCaseWithResult.kt:30)
                                                                                                        at com.owncloud.android.presentation.authentication.AccountAuthenticator.refreshToken(AccountAuthenticator.java:383)
                                                                                                        at com.owncloud.android.presentation.authentication.AccountAuthenticator.getAuthToken(AccountAuthenticator.java:177)
                                                                                                        at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:251)
                                                                                                        at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:253)
                                                                                                        at android.os.Binder.execTransactInternal(Binder.java:1344)
                                                                                                        at android.os.Binder.execTransact(Binder.java:1275)
 
2023-08-01 10:53:15.113 20295-20310 (AccountAu...eshToken() com.owncloud.android.debug           E  OAuth request to refresh access token failed. Preparing to access Login Activity
                                                                                                    com.owncloud.android.domain.exceptions.ServerNotReachableException
                                                                                                        at com.owncloud.android.data.RemoteOperationHandlerKt.handleRemoteOperationResult(RemoteOperationHandler.kt:98)
                                                                                                        at com.owncloud.android.data.RemoteOperationHandlerKt.executeRemoteOperation(RemoteOperationHandler.kt:80)
                                                                                                        at com.owncloud.android.data.oauth.datasources.implementation.OCRemoteOAuthDataSource.performTokenRequest(OCRemoteOAuthDataSource.kt:57)
                                                                                                        at com.owncloud.android.data.oauth.repository.OCOAuthRepository.performTokenRequest(OCOAuthRepository.kt:38)
                                                                                                        at com.owncloud.android.domain.authentication.oauth.RequestTokenUseCase.run(RequestTokenUseCase.kt:30)
                                                                                                        at com.owncloud.android.domain.authentication.oauth.RequestTokenUseCase.run(RequestTokenUseCase.kt:25)
                                                                                                        at com.owncloud.android.domain.BaseUseCaseWithResult.execute(BaseUseCaseWithResult.kt:30)
                                                                                                        at com.owncloud.android.presentation.authentication.AccountAuthenticator.refreshToken(AccountAuthenticator.java:383)
                                                                                                        at com.owncloud.android.presentation.authentication.AccountAuthenticator.getAuthToken(AccountAuthenticator.java:177)
                                                                                                        at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:251)
                                                                                                        at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:253)
                                                                                                        at android.os.Binder.execTransactInternal(Binder.java:1344)
                                                                                                        at android.os.Binder.execTransact(Binder.java:1275)
@jesmrec jesmrec added the Crash label Aug 1, 2023
@jesmrec
Copy link
Collaborator

jesmrec commented Aug 1, 2023

Seems to happen because an incorrect call done from the main thread. Needs a fix.

@jesmrec jesmrec added Type:bug p2-high Escalation, on top of current planning, release blocker labels Aug 1, 2023
@jesmrec jesmrec added this to the 4.1 - Current milestone Aug 1, 2023
@jesmrec jesmrec added the Sprint label Aug 4, 2023
@butonic
Copy link
Member

butonic commented Aug 13, 2023

Moved my login / token comment to #4125 as I think the stack traces are very different. Might be related though...

@Aitorbp Aitorbp self-assigned this Aug 16, 2023
@Aitorbp Aitorbp linked a pull request Aug 16, 2023 that will close this issue
1 task
@Aitorbp Aitorbp linked a pull request Aug 18, 2023 that will close this issue
1 task
@jesmrec jesmrec removed the Sprint label Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash Estimation - 3 (M) p2-high Escalation, on top of current planning, release blocker Type:bug
Projects
None yet
3 participants