Author Topic: exception in Object3D.rotateMesh on OUYA  (Read 1319 times)

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
exception in Object3D.rotateMesh on OUYA
« on: March 23, 2013, 06:04:49 pm »
this exception newer happens on my Nexus 7, my phone or desktop. two Ouya console owners reported this. and it does not always happen. but once happened, level loading fails until application is restarted, possibly because of same exception.

this code runs during level loading in a background thread.

Code: [Select]
java.lang.ArrayIndexOutOfBoundsException: length=11; index=11
  at com.threed.jpct.Vectors.addVertex(Vectors.java:85)
  at com.threed.jpct.Object3D.setBoundingBox(Object3D.java:2507)
  at com.threed.jpct.Object3D.calcBoundingBox(Object3D.java:1197)
  at com.threed.jpct.Object3D.rotateMesh(Object3D.java:2411)
  at raft.jumpy.view.Particle.<init>(Particle.java:66)
  at raft.jumpy.view.ParticleManager.<init>(ParticleManager.java:43)
  at raft.jumpy.view.GameView.<init>(GameView.java:111)
  at raft.jumpy.android.ouya.JumpyActivity$5.run(JumpyActivity.java:522)


and this is the relavant particle class. taken from Robombs code I suppose:

Code: [Select]
   public Particle() {
      super(PLANE, true);
      rotateZ((float)Math.random()*6f);
      rotateMesh();
      clearRotation();
      setBillboarding(Object3D.BILLBOARDING_ENABLED);
      setVisibility(Object3D.OBJ_VISIBLE);
      setCulling(Object3D.CULLING_DISABLED);
      setAdditionalColor(RGBColor.WHITE);
      setLighting(Object3D.LIGHTING_NO_LIGHTS);
      enableLazyTransformations();
      reset();
      shareCompiledData(PLANE);
      build();
      texture="particle_blast";
   }

kind of urgent, OUYA will be launched for backers on 28 march ::)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: exception in Object3D.rotateMesh on OUYA
« Reply #1 on: March 23, 2013, 07:50:36 pm »
Here are a couple more stack traces I got that were slightly different:

Code: [Select]
03-23 18:31:44.762: W/System.err(1291): java.lang.ArrayIndexOutOfBoundsException: length=11; index=12
03-23 18:31:44.762: W/System.err(1291): at com.threed.jpct.Vectors.addVertex(Vectors.java:85)
03-23 18:31:44.762: W/System.err(1291): at com.threed.jpct.Object3D.setBoundingBox(Object3D.java:2513)
03-23 18:31:44.762: W/System.err(1291): at com.threed.jpct.Object3D.calcBoundingBox(Object3D.java:1197)
03-23 18:31:44.762: W/System.err(1291): at com.threed.jpct.Object3D.rotateMesh(Object3D.java:2411)
03-23 18:31:44.762: W/System.err(1291): at raft.jumpy.view.Particle.<init>(Particle.java:66)
03-23 18:31:44.762: W/System.err(1291): at raft.jumpy.view.ParticleManager.<init>(ParticleManager.java:43)
03-23 18:31:44.762: W/System.err(1291): at raft.jumpy.view.GameView.<init>(GameView.java:111)
03-23 18:31:44.762: W/System.err(1291): at raft.jumpy.android.ouya.JumpyActivity$5.run(JumpyActivity.java:522)
(index was 12 instead of the typical 11, in case that's significant)

Code: [Select]
03-23 18:32:34.692: W/System.err(1291): java.lang.ArrayIndexOutOfBoundsException: length=11; index=11
03-23 18:32:34.692: W/System.err(1291): at com.threed.jpct.Mesh.rotateMesh(Mesh.java:682)
03-23 18:32:34.692: W/System.err(1291): at com.threed.jpct.Object3D.rotateMesh(Object3D.java:2406)
03-23 18:32:34.692: W/System.err(1291): at raft.jumpy.view.Particle.<init>(Particle.java:66)
03-23 18:32:34.692: W/System.err(1291): at raft.jumpy.view.ParticleManager.<init>(ParticleManager.java:43)
03-23 18:32:34.692: W/System.err(1291): at raft.jumpy.view.GameView.<init>(GameView.java:111)
03-23 18:32:34.702: W/System.err(1291): at raft.jumpy.android.ouya.JumpyActivity$5.run(JumpyActivity.java:522)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: exception in Object3D.rotateMesh on OUYA
« Reply #2 on: March 23, 2013, 08:47:35 pm »
If this happens in a background thread, it's most likely a threading issue. The particles share the same mesh. If multiple threads are adding vertices (by calculating the bounding box) to that shared mesh, something like this may happen. I've updated the jPCT-AE beta with a version that synchronizes this access. Maybe that helps: http://jpct.de/download/beta/jpct_ae.jar

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: exception in Object3D.rotateMesh on OUYA
« Reply #3 on: March 23, 2013, 11:37:56 pm »
thanks :) I see only one explanation of this, pressing a button via controller somehow creates two events and as a result two threads start to load a level.

paul can you please check the logcat output for a symptom of this, for example consecutive logs like:

Code: [Select]
loading level: xx
without either one of these in between

Code: [Select]
level loaded: xx
Code: [Select]
load level failed. level: xx
« Last Edit: March 24, 2013, 01:03:17 am by raft »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: exception in Object3D.rotateMesh on OUYA
« Reply #4 on: March 26, 2013, 11:20:09 pm »
Has this issue been resolved?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: exception in Object3D.rotateMesh on OUYA
« Reply #5 on: March 26, 2013, 11:28:46 pm »
I just guarded against two simultaneous loading and the problem seems to be gone. after this I've seen some logs which approves two button events actually arrives..