Skip to content

Conversation

@tobiasKaminsky
Copy link
Member

Though I cannot reproduce it, it is good to have client creation in a thread.

Error message was:

0-08 15:43:05.598 22330-22330/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.nextcloud.client, PID: 22330
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nextcloud.client/com.owncloud.android.ui.activity.NotificationsActivity}: java.lang.IllegalStateException: calling this from your main thread can lead to deadlock
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2792)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:172)
        at android.app.ActivityThread.main(ActivityThread.java:6590)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.IllegalStateException: calling this from your main thread can lead to deadlock
        at android.accounts.AccountManager.ensureNotOnMainThread(AccountManager.java:2188)
        at android.accounts.AccountManager.-wrap1(Unknown Source:0)
        at android.accounts.AccountManager$AmsTask.internalGetResult(AccountManager.java:2291)
        at android.accounts.AccountManager$AmsTask.getResult(AccountManager.java:2329)
        at android.accounts.AccountManager$AmsTask.getResult(AccountManager.java:2326)
        at android.accounts.AccountManager.blockingGetAuthToken(AccountManager.java:1514)
        at com.owncloud.android.lib.common.accounts.AccountUtils.getCredentialsForAccount(AccountUtils.java:209)
        at com.owncloud.android.lib.common.OwnCloudAccount.loadCredentials(OwnCloudAccount.java:126)
        at com.owncloud.android.lib.common.SingleSessionManager.getClientFor(SingleSessionManager.java:127)
        at com.owncloud.android.lib.common.DynamicSessionManager.getClientFor(DynamicSessionManager.java:38)
        at com.owncloud.android.lib.common.DynamicSessionManager.getClientFor(DynamicSessionManager.java:30)
        at com.owncloud.android.ui.activity.NotificationsActivity.setupContent(NotificationsActivity.java:239)
        at com.owncloud.android.ui.activity.NotificationsActivity.onCreate(NotificationsActivity.java:160)
        at android.app.Activity.performCreate(Activity.java:7023)
        at android.app.Activity.performCreate(Activity.java:7014)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:172) 
        at android.app.ActivityThread.main(ActivityThread.java:6590) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

Signed-off-by: tobiasKaminsky tobias@kaminsky.me

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@AndyScherzinger
Copy link
Member

AndyScherzinger commented Oct 17, 2018

👍 looks good to me code-wise! 👍

Approved with PullApprove

@nextcloud-android-bot
Copy link
Collaborator

Lint

TypeMasterPR
Warnings9797
Errors

FindBugs (new)

Warning TypeNumber
Bad practice Warnings35
Correctness Warnings167
Internationalization Warnings14
Malicious code vulnerability Warnings10
Multithreaded correctness Warnings9
Performance Warnings124
Security Warnings203
Dodgy code Warnings139
Total701

FindBugs (master)

Warning TypeNumber
Bad practice Warnings35
Correctness Warnings167
Internationalization Warnings14
Malicious code vulnerability Warnings10
Multithreaded correctness Warnings9
Performance Warnings124
Security Warnings203
Dodgy code Warnings139
Total701

@codecov
Copy link

codecov bot commented Oct 17, 2018

Codecov Report

Merging #3153 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

@@             Coverage Diff             @@
##             master   #3153      +/-   ##
===========================================
- Coverage      6.48%   6.46%   -0.02%     
  Complexity        1       1              
===========================================
  Files           307     307              
  Lines         30111   30112       +1     
  Branches       4318    4319       +1     
===========================================
- Hits           1953    1948       -5     
- Misses        27866   27869       +3     
- Partials        292     295       +3
Impacted Files Coverage Δ Complexity Δ
...oud/android/ui/activity/NotificationsActivity.java 0% <0%> (ø) 0 <0> (ø) ⬇️
.../third_parties/daveKoeller/AlphanumComparator.java 80.95% <0%> (-2.39%) 0% <0%> (ø)
...in/java/com/owncloud/android/datamodel/OCFile.java 62.64% <0%> (-1.17%) 0% <0%> (ø)

AndyScherzinger added a commit that referenced this pull request Oct 17, 2018
Backport #3153:Notification: move client creation to thread
@AndyScherzinger AndyScherzinger merged commit c01061b into master Oct 24, 2018
@AndyScherzinger AndyScherzinger deleted the fixNotificationCrash branch October 24, 2018 08:13
@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.4.0 milestone Oct 24, 2018
@MorrisJobke MorrisJobke mentioned this pull request Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants