[TIMOB-28174] Analytics: Exception can occur when constructing payload
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-10-29T13:10:23.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.2.2 |
Components | iOS |
Labels | analytics, ios |
Reporter | VDLP |
Assignee | Gary Mathews |
Created | 2020-09-30T07:35:57.000+0000 |
Updated | 2020-10-29T13:10:23.000+0000 |
Description
After upgrading an application to SDK 9.2.0.GA we noticed that the entire application crashed after calling logHandledException.
To replicate the issue we created a new empty application, set the SDK to 9.2.0 and only used the com.appcelerator.aca module.
Environment information available in the environment field.
index.js code:
const aca = require('com.appcelerator.aca');
add('Breadcrumb', () => {
aca.leaveBreadcrumb('example breadcrumb #1');
// do stuff...
aca.leaveBreadcrumb('example breadcrumb #2');
});
add('Username', () => {
aca.setUsername('Tester');
});
add('Metadata', () => {
// specify metadata using key, value
aca.setMetadata('testKey', 'testKeyValue');
// specify metadata using object
aca.setMetadata({
testObj: 'testObjValue'
});
});
add('Log Exception', () => {
try {
throw new Error('example exception');
} catch (e) {
aca.logHandledException(e);
}
});
add('Opt Out', () => {
aca.setOptOutStatus(!aca.getOptOutStatus());
console.log('set optOutStatus: ' + aca.getOptOutStatus());
});
function add(name, callback) {
const btn = Ti.UI.createButton({ title: name, top:20, left: 5, right: 5 });
btn.addEventListener('click', callback);
$.index.add(btn);
}
$.index.open();
Terminal output:
appc run --project-dir "/Users/vdlp/Mobile/demos/acatest" --log-level info --platform ios --color --no-prompt --liveview --target simulator --sdk "9.2.0.GA" --device-id D2525A08-2CDA-41CA-AB58-F505A055E3E8
Appcelerator Command-Line Interface, version 8.1.1
Copyright (c) 2014-2020, Appcelerator, Inc. All Rights Reserved.
9/30/2020, 9:26:38 AM
Operating System
Name = Mac OS X
Version = 10.15.6
Architecture = 64bit
# CPUs = 8
Memory = 17179869184
Node.js
Node.js Version = 12.9.0
npm Version = 6.14.8
Titanium CLI
CLI Version = 5.2.5
Titanium SDK
SDK Version = 9.2.0.GA
SDK Path = /Users/vdlp/Library/Application Support/Titanium/mobilesdk/osx/9.2.0.GA
Target Platform = iphone
Command
/Users/vdlp/.nvm/versions/node/v12.9.0/bin/node /Users/vdlp/.appcelerator/install/8.1.1/package/node_modules/titanium/lib/titanium.js build --project-dir /Users/vdlp/Mobile/demos/acatest --log-level info --platform ios --color --no-prompt --liveview --target simulator --sdk 9.2.0.GA --device-id D2525A08-2CDA-41CA-AB58-F505A055E3E8 --config-file /var/folders/hy/91fthb9n5rb58slwgwj4l__c0000gn/T/build-1601450786538.json --no-banner --project-dir /Users/vdlp/Mobile/demos/acatest
[INFO] Found Titanium module id=ti.cloud version=3.2.11 platform=commonjs deploy-type=development path=/Users/vdlp/Library/Application Support/Titanium/modules/commonjs/ti.cloud/3.2.11
[INFO] Found Titanium module id=com.appcelerator.aca version=3.0.0 platform=ios deploy-type=development path=/Users/vdlp/Library/Application Support/Titanium/modules/iphone/com.appcelerator.aca/3.0.0
[INFO] Found Titanium plugin id=ti.alloy version=1.0
[INFO] Deploy type: development
[INFO] Building for target: simulator
[INFO] Building using iOS SDK: 13.5
[INFO] Building for iOS Simulator: iPhone 8
[INFO] Building for device family: universal
[INFO] Team ID: n/a
[INFO] Minimum iOS version: 10.0
[INFO] Logging disabled
[INFO] Debugging disabled
[INFO] Profiler disabled
[INFO] Set to copy files instead of symlinking
[INFO] Transpile javascript: true
[INFO] Generate source maps: true
[INFO] Forcing rebuild: tiapp.xml Titanium SDK version changed since last build
[INFO] Was: 8.2.0.GA
[INFO] Now: 9.2.0.GA
[INFO] Initializing the build directory
[INFO] Found Alloy app in /Users/vdlp/Mobile/demos/acatest/app
[INFO] Executing Alloy compile: /Users/vdlp/.nvm/versions/node/v12.9.0/bin/node /Users/vdlp/.appcelerator/install/8.1.1/package/node_modules/alloy/bin/alloy compile /Users/vdlp/Mobile/demos/acatest/app --config platform=ios,version=0,simtype=none,devicefamily=universal,deploytype=development,target=simulator
[INFO] [config.json] config.json unchanged, using cached config.json...
[INFO] ----- MVC GENERATION -----
[INFO] [app.tss] global style processing...
[INFO] [global style] writing to cache...
[INFO] [index.xml] view processing...
[INFO] style: "index.tss"
[INFO] view: "index.xml"
[INFO] controller: "index.js"
[INFO] created: "Resources/iphone/alloy/controllers/index.js"
[INFO] created: "Resources/iphone/alloy/styles/index.js"
[INFO]
[INFO] [app.js] Titanium entry point processing...
[INFO] created: "Resources/iphone/app.js"
[INFO]
[INFO] ----- OPTIMIZING -----
[INFO] - iphone/alloy.bootstrap.js
[INFO] - iphone/alloy.js
[INFO] - iphone/alloy/sync/localStorage.js
[INFO] - iphone/alloy/sync/properties.js
[INFO] - iphone/alloy/sync/sql.js
[INFO]
[INFO] Alloy compiled in 1.26513s
[INFO] Alloy compiler completed successfully
[INFO] Creating Xcode project
[INFO] Creating Entitlements.plist
[INFO] Creating Info.plist
[INFO] Disabling ATS
[INFO] Creating main.m
[INFO] Creating Xcode config files
[INFO] Copying Titanium iOS files
[INFO] Installing default LaunchScreen.storyboard
[INFO] Cleaning Xcode derived data
[INFO] Creating debugger and profiler plists
[INFO] Analyzing Resources directory
[INFO] Analyzing platform files
[INFO] Analyzing module files
[INFO] Analyzing localized launch images
[INFO] Analyzing CommonJS modules
[INFO] Analyzing CommonJS module: ti.cloud
[INFO] Creating asset catalog
[INFO] Creating app icon set
[INFO] Creating launch logo image set
[INFO] Missing 5 launch logos, generating missing launch logos from DefaultIcon.png
[WARN] If this app has been previously installed on this simulator, you may need restart it to see the latest launch logo
[WARN] iOS renders and caches the launch screen to a PNG image that seems to only be invalidated by restarting iOS
[INFO] Missing 17 app icons, generating missing icons
[INFO] appicon-Small.png - Used for iPad - size: 29x29
[INFO] appicon-Small@2x.png - Used for iPhone, iPad - size: 58x58
[INFO] appicon-Small@3x.png - Used for iPhone - size: 87x87
[INFO] appicon-Small-40.png - Used for iPad - size: 40x40
[INFO] appicon-Small-40@2x.png - Used for iPhone, iPad - size: 80x80
[INFO] appicon-Small-40@3x.png - Used for iPhone - size: 120x120
[INFO] appicon-60@2x.png - Used for iPhone - size: 120x120
[INFO] appicon-60@3x.png - Used for iPhone - size: 180x180
[INFO] appicon-76.png - Used for iPad - size: 76x76
[INFO] appicon-76@2x.png - Used for iPad - size: 152x152
[INFO] appicon-83.5@2x.png - Used for iPad - size: 167x167
[INFO] appicon-Marketing.png - Used for iPhone - size: 1024x1024
[INFO] LaunchLogo~iphone - Used for iphone - size: 320x320 - size: 320x320
[INFO] LaunchLogo@2x~iphone - Used for iphone - size: 374x374 - size: 374x374
[INFO] LaunchLogo@3x~iphone - Used for iphone - size: 621x621 - size: 621x621
[INFO] LaunchLogo~ipad - Used for ipad - size: 384x384 - size: 384x384
[INFO] LaunchLogo@2x~ipad - Used for ipad - size: 1024x1024 - size: 1024x1024
[INFO] Processing JavaScript files
[INFO] Writing app properties
[INFO] Writing bootstrap json
[INFO] Creating launch image set
[INFO] Creating assets image set
[INFO] Writing i18n files
[INFO] Processing Titanium symbols
[INFO] Removing files
[INFO] Writing index.json with listing of JS/JSON files
[INFO] Invoking xcodebuild
[INFO] Finished building the application in 1m 1s 989ms
[LiveView] version 1.5.4
[LiveView] Alloy project monitor started
[INFO] Launching iOS Simulator
[LiveView] File Server Started on 0.0.0.0:8324
[LiveView] Event Server Started on 0.0.0.0:8323
[LiveView] Client connected
-- Start simulator log -------------------------------------------------------
[INFO] acatest 1.0 (Powered by Titanium 9.2.0.58a34e529d)
[INFO] ACA started
[INFO] Reachability Flag Status: -R ------- networkStatusForFlags
[LiveView] Alloy recompile initiated for ios
[INFO] Application started
[INFO] Simulator user has requested new graphics quality: 10
[LiveView] Reload Triggered
REASON: File Changed
FILE: /Users/vdlp/Mobile/demos/acatest/app/views/index.xml
[LiveView] Client disconnected
[INFO] [LiveView] Reloading App
[INFO] UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] acatest 1.0 (Powered by Titanium 9.2.0.58a34e529d)
[INFO] ACA started
[INFO] Reachability Flag Status: -R ------- networkStatusForFlags
[LiveView] Client connected
[LiveView] Alloy recompile initiated for ios
[LiveView] Reload Triggered
REASON: File Changed
FILE: /Users/vdlp/Mobile/demos/acatest/app/views/index.xml
[LiveView] Client disconnected
[LiveView] Client connected
[INFO] [LiveView] Reloading App
[INFO] UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] acatest 1.0 (Powered by Titanium 9.2.0.58a34e529d)
[INFO] ACA started
[INFO] Reachability Flag Status: -R ------- networkStatusForFlags
[LiveView] Alloy recompile initiated for ios
[LiveView] Reload Triggered
REASON: File Changed
FILE: /Users/vdlp/Mobile/demos/acatest/app/views/index.xml
[LiveView] Client disconnected
[LiveView] Client connected
[INFO] [LiveView] Reloading App
[INFO] UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] acatest 1.0 (Powered by Titanium 9.2.0.58a34e529d)
[INFO] ACA started
[INFO] Reachability Flag Status: -R ------- networkStatusForFlags
[LiveView] Alloy recompile initiated for ios
[LiveView] Reload Triggered
REASON: File Changed
FILE: /Users/vdlp/Mobile/demos/acatest/app/controllers/index.js
[LiveView] Client disconnected
[LiveView] Client connected
[INFO] [LiveView] Reloading App
[INFO] UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] acatest 1.0 (Powered by Titanium 9.2.0.58a34e529d)
[INFO] ACA started
[INFO] Reachability Flag Status: -R ------- networkStatusForFlags
[LiveView] Client disconnected
[ERROR] Script Error {
[ERROR] column = 30;
[ERROR] line = 77;
[ERROR] message = "*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]";
[ERROR] nativeStack = "3 CoreFoundation 0x00007fff23eda4a6 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.4 + 38\n4 CoreFoundation 0x00007fff23e9b787 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 247\n5 CoreFoundation 0x00007fff23e38e11 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49\n6 TitaniumKit0x000000010c55e386 -[APSAnalytics createDataPayload:] + 478\n7 TitaniumKit0x000000010c55d5c3 -[APSAnalytics sendCrashReport:] + 30\n8 acatest 0x000000010c1cedf5 -[ComAppceleratorAcaModule handleScriptError:handled:] + 968\n9 acatest 0x000000010c1ce292 -[ComAppceleratorAcaModule logHandledException:] + 370\n10 CoreFoundation 0x00007fff23e43e8c __invoking___ + 140\n11 CoreFoundation 0x00007fff23e41071 -[NSInvocation invoke] + 321\n12 TitaniumKit0x000000010c54f1a2 -[KrollMethod call:] + 1382\n13 TitaniumKit0x000000010c54e3ad __KrollCallAsFunction_block_invoke + 30\n14 TitaniumKit0x000000010c54e1c7 KrollCallAsFunction + 415\n15 JavaScriptCore 0x00007fff26c91223 _ZN3JSC16JSCallbackObjectINS_16JSNonFinalObjectEE4callEPNS_14JSGlobalObjectEPNS_9CallFrameE + 627\n16 JavaScriptCore 0x00007fff271649bf _ZN3JSC5LLInt9setUpCallEPNS_9CallFrameENS_22CodeSpecializationKindENS_7JSValueEPNS_17LLIntCallLinkInfoE + 959\n17 JavaScriptCore 0x00007fff26c4e73f llint_entry + 93330\n18 JavaScriptCore 0x00007fff26c378ff vmEntryToJavaScript + 200\n19 JavaScriptCore 0x00007fff2706e6d5 _ZN3JSC11Interpreter11executeCallEPNS_14JSGlobalObjectEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 549\n20 JavaScriptCore 0x00007fff272a898a _ZN3JSC12profiledCallEPNS_14JSGlobalObjectENS_15ProfilingReasonENS_7JSValueENS_8CallTypeERKNS_8CallDataES3_RKNS_7ArgListE + 170\n21 JavaScriptCore 0x00007fff26c9f75c JSObjectCallAsFunction + 620\n22 TitaniumKit0x000000010c52b1e9 TiBindingEventProcess + 686";
[ERROR] stack = "[native code]\n";
[ERROR] type = Error;
[ERROR] }
Any updates on this? I see the priority has been changed from critical to low. What's the reasoning behind this? We're currently unable to upgrade our applications because they crash when we attempt to report exceptions. If we could prevent this in any way that would be great.
https://github.com/appcelerator/titanium_mobile/pull/12220
FR Passed, Waiting on Jenkins build and build for 9_2_X.
merged to master for 9.3.0 target. backport PR for 9_2_X merged for 9.2.2 target.
*Closing ticket*. Fix verified in SDK version
9.3.0.v20201028071437
, and9.2.2.v20201028132228
. *Test and other information can be found at:* https://github.com/appcelerator/titanium_mobile/pull/12220