Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6707] 1.8.0.1 RC1 Android creating KrollProxy instances at runtime fails

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2011-12-16T12:34:25.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2011-50, Release 1.8.0.1, Release 2.0.0
ComponentsAndroid
Labelsverified-1.8.0.1
ReporterRuben Fonseca
AssigneeOpie Cyrus
Created2011-12-15T10:05:34.000+0000
Updated2012-01-11T15:25:34.000+0000

Description

I have a Proxy called SessionProxy on a native Android module. I also have another Proxy called ClientProxy on the same module. Somewhere in the code inside SessionProxy, I need to return an instance of the ClientProxy. So normally I write (Java code): ClientProxy c = new ClientProxy(); The code compiles, but in runtime, it crashes: E/ProxyFactory( 1592): Failed to find class for com.Ox82.ClientProxy E/ProxyFactory( 1592): Unable to find class while creating V8 Proxy.I/DEBUG ( 28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***I/DEBUG ( 28): Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys' I/DEBUG ( 28): pid: 1592, tid: 1600 >>> com.Ox82.dropbox <<< I/DEBUG ( 28): signal 11 (SIGSEGV), fault addr 00000000 I/DEBUG ( 28): r0 570209dd r1 570209e9 r2 00000000 r3 00000000 I/DEBUG ( 28): r4 00307afc r5 00000000 r6 00307b00 r7 00308af0 I/DEBUG ( 28): r8 00000000 r9 00307b00 10 00307b04 fp 00000000 I/DEBUG ( 28): ip 00000000 sp 45a40bb8 lr 81287e18 pc 8117f804 cpsr 80000010 I/DEBUG ( 28): #00 pc 0017f804 /data/data/com.Ox82.dropbox/lib/libkroll-v8.soI/DEBUG ( 28): #01 lr 81287e18 /data/data/com.Ox82.dropbox/lib/libkroll-v8.so That didn't happened on < 1.8 SDK.

Attachments

FileDateSize
tps.zip2011-12-15T15:29:47.000+000011820

Comments

  1. Dawson Toth 2011-12-15

    Reproduced in CI from earlier today and in our Box module with V8.

    Reproduction

    Drop the following in an app.js:
       var tps = require('ti.tps');
       
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       win.add(Ti.UI.createLabel({
           text: 'Is It Working? The answer is... ' 
               + (tps.retrieveReport().isWorking ? 'Yes! t(^_^t)' : 'No <(-_-<)')
       }));
       win.open();
       
    Create a module:
       titanium1801 create --type=module --name=tps --id=ti.tps --platform=android
       
    Change TpsModule.java to the following:
       package ti.tps;
       
       import org.appcelerator.kroll.KrollModule;
       import org.appcelerator.kroll.annotations.Kroll;
       
       @Kroll.module(name = "Tps", id = "ti.tps")
       public class TpsModule extends KrollModule {
       	@Kroll.method
       	public ExampleProxy retrieveReport() {
       		return new ExampleProxy();
       	}
       }
       
    Change ExampleProxy.java to the following:
       package ti.tps;
       
       import org.appcelerator.kroll.KrollProxy;
       import org.appcelerator.kroll.annotations.Kroll;
       
       @Kroll.proxy()
       public class ExampleProxy extends KrollProxy {
       	@Kroll.getProperty
       	public boolean getIsWorking() {
       		return true;
       	}
       }
       
    Run with V8 and watch the logs.

    Error Logs

    I see the following: {quote} 12-15 15:21:30.359: V/InputDevice(2449): ID[0]=0(0) Dn(0=>1) 12-15 15:21:30.366: V/WindowManager(2449): Dsptch > Window{48930250 com.fede.launcher/com.fede.launcher.Launcher paused=false} 12-15 15:21:30.441: V/WindowManager(2449): Dsptch > Window{48930250 com.fede.launcher/com.fede.launcher.Launcher paused=false} 12-15 15:21:30.441: V/InputDevice(2449): ID[0]=0(0) Up(1=>0) 12-15 15:21:30.444: I/ActivityManager(2449): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=ti.tps/.TpsActivity bnds=[125,234][235,364] } 12-15 15:21:30.511: I/ActivityManager(2449): Start proc ti.tps for activity ti.tps/.TpsActivity: pid=18738 uid=10110 gids={1015, 3003} 12-15 15:21:30.585: I/TiApplication(18738): (main) [0,0] checkpoint, app created. 12-15 15:21:30.628: I/TiApplication(18738): (main) [47,47] Titanium 1.8.0.1 (2011/12/15 09:16 21968ea) 12-15 15:21:30.714: I/TiApplication(18738): (main) [84,131] Titanium Javascript runtime: v8 12-15 15:21:30.722: D/dalvikvm(18738): Trying to load lib /data/data/ti.tps/lib/libstlport_shared.so 0x482fe0e0 12-15 15:21:30.722: D/dalvikvm(18738): Added shared lib /data/data/ti.tps/lib/libstlport_shared.so 0x482fe0e0 12-15 15:21:30.722: D/dalvikvm(18738): No JNI_OnLoad found in /data/data/ti.tps/lib/libstlport_shared.so 0x482fe0e0, skipping init 12-15 15:21:30.730: W/TiApplication(18738): (main) [16,147] activity stack is emtpy, unable to get current activity 12-15 15:21:30.734: D/dalvikvm(18738): Trying to load lib /data/data/ti.tps/lib/libkroll-v8.so 0x482fe0e0 12-15 15:21:30.734: I/TiRootActivity(18738): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null 12-15 15:21:30.749: D/dalvikvm(18738): Added shared lib /data/data/ti.tps/lib/libkroll-v8.so 0x482fe0e0 12-15 15:21:30.788: D/dalvikvm(18738): GC_FOR_MALLOC freed 3715 objects / 341936 bytes in 35ms 12-15 15:21:30.855: W/TiApplication(18738): (main) [119,119] activity stack is emtpy, unable to get current activity 12-15 15:21:30.855: W/TiApplication(18738): (main) [1,120] activity stack is emtpy, unable to get current activity 12-15 15:21:30.855: W/TiApplication(18738): (main) [0,120] activity stack is emtpy, unable to get current activity 12-15 15:21:31.179: E/TiApplication(18738): (KrollRuntimeThread) [326,446] APP PROXY: ti.modules.titanium.app.AppModule@48307d18 12-15 15:21:31.218: D/dalvikvm(18738): Trying to load lib /data/data/ti.tps/lib/libti.tps.so 0x482fe0e0 12-15 15:21:31.218: D/dalvikvm(18738): Added shared lib /data/data/ti.tps/lib/libti.tps.so 0x482fe0e0 12-15 15:21:31.218: D/dalvikvm(18738): No JNI_OnLoad found in /data/data/ti.tps/lib/libti.tps.so 0x482fe0e0, skipping init 12-15 15:21:31.288: E/ProxyFactory(18738): Failed to find class for ti.tps.ExampleProxy 12-15 15:21:31.288: E/ProxyFactory(18738): Unable to find class while creating V8 Proxy. 12-15 15:21:31.382: E/TiJSError(18738): (main) [203,649] ----- Titanium Javascript Runtime Error ----- 12-15 15:21:31.382: E/TiJSError(18738): (main) [0,649] - In app.js:8,32 12-15 15:21:31.382: E/TiJSError(18738): (main) [0,649] - Message: Uncaught TypeError: Cannot read property 'isWorking' of undefined 12-15 15:21:31.382: E/TiJSError(18738): (main) [1,650] - Source: + (tps.retrieveReport().isWorking ? 'Yes! t(^_^t)' : 'No <(-_-<)') 12-15 15:21:31.409: E/V8Exception(18738): Exception occurred at app.js:8: Uncaught TypeError: Cannot read property 'isWorking' of undefined 12-15 15:21:31.444: I/TiRootActivity(18738): (main) [0,0] checkpoint, on root activity resume. activity = ti.tps.TpsActivity@4836fe08 12-15 15:21:31.601: I/ActivityManager(2449): Displayed activity ti.tps/.TpsActivity: 1099 ms (total 1099 ms) {quote}
  2. Dawson Toth 2011-12-15

    Attached zip of the "tps" module I referenced in my comment for reproducing this issue.
  3. Wilson Luu 2011-12-19

    Verified fix on: SDK build: 1.8.0.1.RC3 Runtime: V8, Rhino Titanium Studio, build: 1.0.7.201112152014 Device: Nexus One (2.2.2) OS: Mac OS X Lion Note: Did not verify fix on sdk build 1.9.0
  4. Wilson Luu 2012-01-11

    Closing bug. Already verified fix on 1.8.0.1

JSON Source