mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
report stack of lock owner to crashlytics when can't get it
I'm seeing something permanently lock a game so it can't be opened. So add code to report the stack of the owner to Crashlytics when opening fails 3 times in a row. It's stubbed out for non-debug builds.
This commit is contained in:
parent
813cf4f961
commit
7f2e3207be
5 changed files with 32 additions and 1 deletions
|
@ -70,6 +70,7 @@ android {
|
||||||
resValue "string", "invite_prefix", "/and/"
|
resValue "string", "invite_prefix", "/and/"
|
||||||
buildConfigField "int[]", "SMS_BANNED_EXPL", "null"
|
buildConfigField "int[]", "SMS_BANNED_EXPL", "null"
|
||||||
buildConfigField "boolean", "UDP_ENABLED", "true"
|
buildConfigField "boolean", "UDP_ENABLED", "true"
|
||||||
|
buildConfigField "boolean", "REPORT_LOCKS", "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
xw4 {
|
xw4 {
|
||||||
|
@ -104,6 +105,7 @@ android {
|
||||||
buildConfigField "boolean", "WIDIR_ENABLED", "true"
|
buildConfigField "boolean", "WIDIR_ENABLED", "true"
|
||||||
buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "true"
|
buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "true"
|
||||||
buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug\""
|
buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug\""
|
||||||
|
buildConfigField "boolean", "REPORT_LOCKS", "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
xw4dNoSMS {
|
xw4dNoSMS {
|
||||||
|
|
|
@ -510,6 +510,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
m_activity = delegator.getActivity();
|
m_activity = delegator.getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int s_noLockCount = 0; // supports a quick debugging hack
|
||||||
protected void init( Bundle savedInstanceState )
|
protected void init( Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
m_isFirstLaunch = null == savedInstanceState;
|
m_isFirstLaunch = null == savedInstanceState;
|
||||||
|
@ -544,7 +545,13 @@ public class BoardDelegate extends DelegateBase
|
||||||
public void gotLock( GameLock lock ) {
|
public void gotLock( GameLock lock ) {
|
||||||
if ( null == lock ) {
|
if ( null == lock ) {
|
||||||
finish();
|
finish();
|
||||||
|
if ( BuildConfig.REPORT_LOCKS && ++s_noLockCount == 3 ) {
|
||||||
|
String msg = "BoardDelegate unable to get lock; holder stack: "
|
||||||
|
+ GameLock.getHolderStack( m_rowid );
|
||||||
|
CrashTrack.logAndSend( msg );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
s_noLockCount = 0;
|
||||||
m_jniThreadRef = JNIThread.getRetained( lock );
|
m_jniThreadRef = JNIThread.getRetained( lock );
|
||||||
|
|
||||||
// see http://stackoverflow.com/questions/680180/where-to-stop- \
|
// see http://stackoverflow.com/questions/680180/where-to-stop- \
|
||||||
|
|
|
@ -64,7 +64,6 @@ public class GameLock implements AutoCloseable, Serializable {
|
||||||
Owner()
|
Owner()
|
||||||
{
|
{
|
||||||
mThread = Thread.currentThread();
|
mThread = Thread.currentThread();
|
||||||
// mTrace = mThread.getStackTrace();
|
|
||||||
mTrace = android.util.Log.getStackTraceString(new Exception());
|
mTrace = android.util.Log.getStackTraceString(new Exception());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +360,13 @@ public class GameLock implements AutoCloseable, Serializable {
|
||||||
} ).start();
|
} ).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getHolderStack( long rowid )
|
||||||
|
{
|
||||||
|
GameLockState state = getFor( rowid );
|
||||||
|
Owner owner = state.mOwners.peek();
|
||||||
|
return owner.mTrace;
|
||||||
|
}
|
||||||
|
|
||||||
// used only for asserts
|
// used only for asserts
|
||||||
public boolean canWrite()
|
public boolean canWrite()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,4 +24,5 @@ import android.content.Context;
|
||||||
|
|
||||||
public class CrashTrack {
|
public class CrashTrack {
|
||||||
public static void init( Context context ) {} // does nothing here
|
public static void init( Context context ) {} // does nothing here
|
||||||
|
public static void logAndSend( String msg ) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,19 @@ public class CrashTrack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void logAndSend( String msg )
|
||||||
|
{
|
||||||
|
Crashlytics.log( msg );
|
||||||
|
new Thread( new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
String foo = null;
|
||||||
|
try {
|
||||||
|
Thread.sleep( 5000 );
|
||||||
|
throw new RuntimeException( "crash generator" );
|
||||||
|
} catch ( InterruptedException ex ) {}
|
||||||
|
}
|
||||||
|
} ).start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue