From 9fe01047b1da518d3b1abebe2762305dde086977 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 11 Feb 2019 07:52:22 -0800 Subject: [PATCH] include stack of lock owner when logging failure to lock --- .../java/org/eehouse/android/xw4/BoardDelegate.java | 2 +- .../main/java/org/eehouse/android/xw4/DbgUtils.java | 6 ++++-- .../java/org/eehouse/android/xw4/GameUtils.java | 13 ++++++++----- .../org/eehouse/android/xw4/XWServiceHelper.java | 3 ++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index 0132d2a16..d54cbaac4 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -2805,7 +2805,7 @@ public class BoardDelegate extends DelegateBase gi = new CurGameInfo( activity ); gamePtr = GameUtils.loadMakeGame( activity, gi, lock ); } else { - DbgUtils.toastNoLock( TAG, activity, + DbgUtils.toastNoLock( TAG, activity, rowID, "setupRematchFor(%d)", rowID ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java index 4acbff84a..c2266e947 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DbgUtils.java @@ -57,14 +57,16 @@ public class DbgUtils { showf( context, LocUtils.getString( context, formatid ), args ); } // showf - public static void toastNoLock( String tag, Context context, String format, - Object... args ) + public static void toastNoLock( String tag, Context context, long rowid, + String format, Object... args ) { format = "Unable to lock game; " + format; if ( BuildConfig.DEBUG ) { showf( context, format, args ); } Log.w( tag, format, args ); + Log.w( tag, "stack for lock owner for %d", rowid ); + Log.w( tag, GameLock.getHolderStack( rowid ) ); } public static void assertOnUIThread() diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java index a664520a1..eb813b5e8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GameUtils.java @@ -174,8 +174,8 @@ public class GameUtils { Utils.cancelNotification( context, (int)rowidIn ); success = true; } else { - DbgUtils.toastNoLock( TAG, context, "resetGame(): rowid %d", - rowidIn ); + DbgUtils.toastNoLock( TAG, context, rowidIn, + "resetGame(): rowid %d", rowidIn ); } } return success; @@ -309,7 +309,8 @@ public class GameUtils { deleteGame( context, lock, informNow ); success = true; } else { - DbgUtils.toastNoLock( TAG, context, "deleteGame(): rowid %d", + DbgUtils.toastNoLock( TAG, context, rowid, + "deleteGame(): rowid %d", rowid ); success = false; } @@ -971,7 +972,8 @@ public class GameUtils { } } } catch ( GameLock.GameLockedException gle ) { - DbgUtils.toastNoLock( TAG, context, "feedMessage(): dropping message " + DbgUtils.toastNoLock( TAG, context, rowid, + "feedMessage(): dropping message " + " for %d", rowid ); } } @@ -1012,7 +1014,8 @@ public class GameUtils { summarizeAndRelease( context, lock, gamePtr, gi ); } else { - DbgUtils.toastNoLock( TAG, context, "replaceDicts(): rowid %d", + DbgUtils.toastNoLock( TAG, context, rowid, + "replaceDicts(): rowid %d", rowid ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java index 805e36686..a29e76904 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWServiceHelper.java @@ -142,7 +142,8 @@ abstract class XWServiceHelper { .loadMakeGame( mService, gi, lock ); gamePtr.release(); } else { - DbgUtils.toastNoLock( TAG, context, "handleInvitation()" ); + DbgUtils.toastNoLock( TAG, context, rowid, + "handleInvitation()" ); } }