Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12969] Crittercism module does not show any crash or handled exception in live stat section

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-20T23:44:40.000+0000
Affected Version/sRelease 3.0.1, Release 3.0.2
Fix Version/s2013 Sprint 06 API, 2013 Sprint 06
ComponentsAndroid
Labelsmobilesdk, module, titanium
ReporterAshish Nigam
AssigneeBlain Hamon
Created2013-03-06T09:37:23.000+0000
Updated2017-03-21T21:36:56.000+0000

Description

I Tested the sample code provided with Crittercism module and found that live stats are not working for Crash and Handled Exception with Android 2.2 and above. Also i get app load only for 1st time app launch with Titanium SDK version change. like when i change TiSDK from 3.0.0 to 3.0.2 or vice versa.
Ti.API.info("Ti App: importing Crittercism...");
var crittercism = require('com.crittercism.ti.android');
Ti.API.info("module is => " + crittercism + "\n");

Ti.API.info("Ti App: initializing Crittercism...");

crittercism.init("5004e9d1be790e78f2000006");

Ti.API.info("Ti App: Crittercism initialized\n");

var win = Titanium.UI.createWindow({
	title : 'Crittercism Test',
	backgroundColor : '#fff'
});
crittercism.leaveBreadcrumb("Creating window");

var topLabel = Titanium.UI.createLabel({
	top:10,
	color : '#999',
	text : 'Crittercism Test App!',
	font : {
		fontSize : 16,
		fontFamily : 'Helvetica Neue'
	},
	width : 'auto'
});

win.add(topLabel);

var setMetaData = Titanium.UI.createButton({
	top:35,
	width:301,
	height:30,
	title:'Set Metadata'
});

setMetaData.addEventListener('click', function()
{
	crittercism.leaveBreadcrumb("setMetaData // Setting Username");
	crittercism.setUsername("TomCritter");
	try {
		crittercism.leaveBreadcrumb("Attempting to add Metadata");
		crittercism.setMetadata({
			"gameLevel": 5,
			"email": "support@crittercism.com",
			"playerID": 9491824
			});
	} catch (e) {
		Ti.API.error("set Metadata: JSON failed");
	}
	
});

win.add(setMetaData);

var crashButton = Titanium.UI.createButton({
	top:70,
	width:301,
	height:30,
	title:'Crash'
});

crashButton.addEventListener('click', function()
{
	crittercism.leaveBreadcrumb("Clicking the crash button");
	// create an array with an invalid size
	var a = new Array(0x100000000);
	
	var array = new Array();
	// access an index out of bounds
	array[-4]; // this doesn't get caught
	
	win.add(array[-4]); // this gets caught
	
	// throw an exceptions
	var er = new Error("My Not as Awesome Uncaught Error!");
	throw er
});

win.add(crashButton);

var handledButton = Titanium.UI.createButton({
	top:105,
	width:301,
	height:30,
	title:'Send Handled Exception'
});

handledButton.addEventListener('click', function()
{	
	try {
		crittercism.leaveBreadcrumb("Attempting some awesome task...");
		var err = new Error("My Awesome Caught Error!");
		throw err
	} catch (err){
		crittercism.leaveBreadcrumb("Oh no, it failed! Log it...");
		crittercism.logHandledException({
			name: err.name,
			message: err.message,
			line:err.lineNumber
		});
	}
});

win.add(handledButton);

var status = false;

var optOutToggle = Titanium.UI.createButton({
	top:140,
	width:301,
	height:30,
	title:'Toggle OptOut Status: No'
});

optOutToggle.addEventListener('click', function()
{
	// Set the status
	crittercism.setOptOutStatus(status = !status);
	
	// change the status in the button title for visibility
	var stringStatus = crittercism.getOptOutStatus() ? "Yes" : "No";
	optOutToggle.title = 'Toggle OptOut Status: ' + stringStatus;
});

win.add(optOutToggle);

win.open();


Comments

  1. Shak Hossain 2013-03-20

    Max, We tested the issue in house. Exceptions are getting populated into the dashboard properly. However, the crash reports not being recorded or get populated into the dashboard. Shak
  2. Blain Hamon 2013-03-20

    When starting up, we see in logcat:
       I/ActivityManager(  238): Start proc com.appcelerator.crittercismTest1 for activity com.appcelerator.crittercismTest1/.Crittercismtest1Activity: pid=16427 uid=10061 gids={1015, 1007, 3003}
       I/dalvikvm(16427): Turning on JNI app bug workarounds for target SDK version 8...
       ...
       I/TiAPI   (16427):  Ti App: importing Crittercism...
       I/TiAPI   (16427):  module is => [object Object]
       I/TiAPI   (16427):  Ti App: initializing Crittercism...
       I/APACHE HTTP (thCr=24364) - NafHttpAuthStrategyDefault(16427): (thUse=24364) NafHttpAuthStrategyDefault()
       I/APACHE HTTP (thCr=24364) - KeeperManager(16427): (thUse=24364) INITIALIZATION of shared resources
       I/APACHE HTTP (thCr=24364) - AndroidContextProviderImpl(16427): (thUse=24364)    currentActivityThread=null
       I/APACHE HTTP (thCr=24364) - GbaSupportIndicatorRequestUpdaterDefault(16427): (thUse=24364) GbaSupportIndicatorRequestUpdaterAbstract()   userHeaderPredefined=null
       I/Crittercism(16427): Crittercism Initialized.
       I/Crittercism(16427): sendAppLoadData() will only send data to Crittercism if "delaySendingAppLoad" is set to true in the configuration settings you include in the init call.
       I/TiAPI   (16427):  Ti App: Crittercism initialized
       I/APACHE HTTP (thCr=24364) - NafHttpAuthStrategyDefault(16427): (thUse=24370)    cached value : gbaSupportIsPossible=null
       I/APACHE HTTP (thCr=24364) - NafHttpAuthStrategyDefault(16427): (thUse=24370)    The current context is NOT a context of GBA service.
       I/APACHE HTTP (thCr=24364) - GbaSupportPermissionRequestCheckerImpl(16427): (thUse=24370) isCurrentProcessRequestedGba()#finished   result=false
       I/APACHE HTTP (thCr=24364) - GbaSupportPermissionRequestCheckerImpl(16427): (thUse=24370) isCurrentProcessAllowedToUseGba()#started   result=false
       I/APACHE HTTP (thCr=24364) - NafHttpAuthStrategyDefault(16427): (thUse=24370)    The GBA permission wasn't requested for this process.
       I/APACHE HTTP (thCr=24364) - NafHttpAuthStrategyDefault(16427): (thUse=24370) It is impossible to support GBA now (many possible reasons: no Android Context, current client is GBA service, etc.), then it will be just usual HTTP.
       I/APACHE HTTP (thCr=24370) - NafRequestExecutorWrapperRedirectionHandler(16427): (thUse=24370)    It isn't GBA flow, redirection responses are not handled.
       
    Stack Overflow says [this might be okay](http://stackoverflow.com/questions/11840937/apache-http-client-nafhttpauthstrategydefault). Odder and odder. In clicking the 'send handled exception', I see in the logcat:
       I/System  (16427): Failed to destroy process 16558
       I/System  (16427): libcore.io.ErrnoException: kill failed: ESRCH (No such process)
       I/System  (16427): 	at libcore.io.Posix.kill(Native Method)
       I/System  (16427): 	at libcore.io.ForwardingOs.kill(ForwardingOs.java:77)
       I/System  (16427): 	at java.lang.ProcessManager$ProcessImpl.destroy(ProcessManager.java:257)
       I/System  (16427): 	at crittercism.android.b$a.d(Unknown Source)
       I/System  (16427): 	at crittercism.android.b$a.call(Unknown Source)
       I/System  (16427): 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
       I/System  (16427): 	at java.util.concurrent.FutureTask.run(FutureTask.java:137)
       I/System  (16427): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
       I/System  (16427): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
       I/System  (16427): 	at java.lang.Thread.run(Thread.java:864)
       
    Without much investigation into the code, this looks internal to Crittercism, given the class name does not have ti in the path. As far as I can tell, Crittercism may have a service set up (the one we're trying to kill) and some logic is causing an exception to stop us from logging. Question is: Where do we go from here? Are we actually seeing any of this showing up on the crittercism site?
  3. Blain Hamon 2013-03-20

    Okay, an update: In generating a new application code ( 514a43cf5f721646f000000a ) for the app, I could see the handled exceptions show up fine. Despite the button label, the crash is actually an exception, even if one presses Kill. Crash Test Dummy would be needed to test an actual crash. I'm not sure what the actual issue is. Moving to cannot reproduce until more detail is given.
  4. Blain Hamon 2013-03-20

    Please provide more information, and reopen then.
  5. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source