[TIMOB-23753] Android: Crash when adding Ti.Network event listener
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-17T13:53:37.000+0000 |
Affected Version/s | Release 6.0.0 |
Fix Version/s | Release 6.0.0 |
Components | Android |
Labels | n/a |
Reporter | Martin Guillon |
Assignee | Christopher Williams |
Created | 2016-08-10T13:23:27.000+0000 |
Updated | 2016-08-24T00:23:37.000+0000 |
Description
This snippet of code:
Ti.Network.addEventListener('change', function() {
console.log('test');
})
Will result in a hard crash:
08-10 07:41:49.296: I/DEBUG(85): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-10 07:41:49.296: I/DEBUG(85): Build fingerprint: 'generic/vbox86p/vbox86p:5.1/LMY47D/buildbot11172007:userdebug/test-keys'
08-10 07:41:49.296: I/DEBUG(85): Revision: '0'
08-10 07:41:49.296: I/DEBUG(85): ABI: 'x86'
08-10 07:41:49.296: I/DEBUG(85): pid: 3345, tid: 3364, name: KrollRuntimeThr >>> com.appcelerator.sample.ti520 <<<
08-10 07:41:49.296: I/DEBUG(85): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8549c081
08-10 07:41:49.300: I/DEBUG(85): eax 8549c081 ebx e2681d60 ecx dc8dc81d edx dc8dc81d
08-10 07:41:49.300: I/DEBUG(85): esi 39948671 edi 00000000
08-10 07:41:49.300: I/DEBUG(85): xcs 00000023 xds 0000002b xes 0000002b xfs 0000006f xss 0000002b
08-10 07:41:49.300: I/DEBUG(85): eip e1fb1f14 ebp e28ce148 esp e28cdec0 flags 00210296
08-10 07:41:49.300: I/DEBUG(85): backtrace:
08-10 07:41:49.300: I/DEBUG(85): #00 pc 007d4f14 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::internal::GlobalHandles::MakeWeak(v8::internal::Object**, void*, void (*)(v8::WeakCallbackData<v8::Value, void> const&))+20)
08-10 07:41:49.300: I/DEBUG(85): #01 pc 004b0c3b /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::V8::MakeWeak(v8::internal::Object**, void*, void (*)(v8::WeakCallbackData<v8::Value, void> const&))+43)
08-10 07:41:49.300: I/DEBUG(85): #02 pc 002badf8 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (titanium::JavaObject::getJavaObject()+88)
08-10 07:41:49.300: I/DEBUG(85): #03 pc 002bfb6e /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (titanium::Proxy::hasListenersForEventType(v8::FunctionCallbackInfo<v8::Value> const&)+174)
08-10 07:41:49.300: I/DEBUG(85): #04 pc 004e10b4 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))+148)
08-10 07:41:49.300: I/DEBUG(85): #05 pc 0053fedb /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so
08-10 07:41:49.300: I/DEBUG(85): #06 pc 005406ec /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so
08-10 07:41:49.300: I/DEBUG(85): #07 pc 0000007d <unknown>
08-10 07:41:49.300: I/DEBUG(85): #08 pc 000a2ae2 <unknown>
08-10 07:41:49.300: I/DEBUG(85): #09 pc 000138f5 <unknown>
08-10 07:41:49.300: I/DEBUG(85): #10 pc 0006a0cf <unknown>
08-10 07:41:49.300: I/DEBUG(85): #11 pc 000138f5 <unknown>
08-10 07:41:49.300: I/DEBUG(85): #12 pc 0006a338 <unknown>
08-10 07:41:49.301: I/DEBUG(85): #13 pc 0001533d <unknown>
08-10 07:41:49.301: I/DEBUG(85): #14 pc 000112a2 <unknown>
08-10 07:41:49.301: I/DEBUG(85): #15 pc 007a25fc /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so
08-10 07:41:49.301: I/DEBUG(85): #16 pc 007a2908 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*)+120)
08-10 07:41:49.301: I/DEBUG(85): #17 pc 004d8ace /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::Script::Run(v8::Local<v8::Context>)+382)
08-10 07:41:49.301: I/DEBUG(85): #18 pc 004d8dd9 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::Script::Run()+73)
08-10 07:41:49.301: I/DEBUG(85): #19 pc 002cfa76 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (void titanium::WrappedScript::EvalMachine<(titanium::WrappedScript::EvalInputFlags)0, (titanium::WrappedScript::EvalContextFlags)0, (titanium::WrappedScript::EvalOutputFlags)0>(v8::FunctionCallbackInfo<v8::Value> const&)+262)
08-10 07:41:49.301: I/DEBUG(85): #20 pc 002cfbeb /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (titanium::WrappedScript::CompileRunInThisContext(v8::FunctionCallbackInfo<v8::Value> const&)+27)
08-10 07:41:49.301: I/DEBUG(85): #21 pc 004e10b4 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))+148)
08-10 07:41:49.301: I/DEBUG(85): #22 pc 0053fedb /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so
08-10 07:41:49.301: I/DEBUG(85): #23 pc 005406ec /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so
08-10 07:41:49.301: I/DEBUG(85): #24 pc 0000007d <unknown>
08-10 07:41:49.301: I/DEBUG(85): #25 pc 00069ade <unknown>
08-10 07:41:49.301: I/DEBUG(85): #26 pc 00067792 <unknown>
08-10 07:41:49.301: I/DEBUG(85): #27 pc 00065bf6 <unknown>
08-10 07:41:49.301: I/DEBUG(85): #28 pc 0001533d <unknown>
08-10 07:41:49.301: I/DEBUG(85): #29 pc 000112a2 <unknown>
08-10 07:41:49.301: I/DEBUG(85): #30 pc 007a25fc /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so
08-10 07:41:49.301: I/DEBUG(85): #31 pc 007a2908 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*)+120)
08-10 07:41:49.301: I/DEBUG(85): #32 pc 004d6e63 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*)+323)
08-10 07:41:49.301: I/DEBUG(85): #33 pc 002c9b15 /data/app/com.appcelerator.sample.ti520-2/lib/x86/libkroll-v8.so (Java_org_appcelerator_kroll_runtime_v8_V8Runtime_nativeRunModule+389)
08-10 07:41:49.301: I/DEBUG(85): #34 pc 003f8e2b /data/dalvik-cache/x86/data@app@com.appcelerator.sample.ti520-2@base.apk@classes.dex
08-10 07:41:49.336: I/DEBUG(85): Tombstone written to: /data/tombstones/tombstone_08
08-10 07:41:49.336: I/BootReceiver(667): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
08-10 07:41:49.359: I/Zygote(383): Process 3345 exited due to signal (11)
Looks like maybe this is caused by being unable to unwrap the JS object to the native proxy somehow. My best guess is that I'm using args.Holder() when I should be using args.This() ? Using debug libraries, I get the following crash:
Thinking back, I had run into something similar to this for some method calls on proxies - the This/Holder object wasn't the object wrapping the proxy as we expected (likely due to some lazy instantiation/wrapping stuff we do around the proxies). In that scenario, I hacked it to basically search up the prototype chain of Holder to find the proxy we're looking for: https://github.com/appcelerator/titanium_mobile/pull/8041/files#diff-16204ab8e9743a30e6e6f874a876539eR227
You are talking about the Proxy::unwrap method? Already tried that and it still crashed
https://github.com/appcelerator/titanium_mobile/pull/8208
Verified the fix.
Ti.Network
event listener does not cause a crash. Closing. Environment: Appc Studio : 4.7.1.201608190732 Ti SDK : 6.0.0.v20160822133504 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.7 Appc CLI : 6.0.0-26 Node: 4.4.4 Nexus 6 - Android 6.0.1