Java.lang.RuntimeException: Ring buffer overflow

Hi,
when I make the deployment of my game in my tablet I get the following exception:

W/dalvikvm( 3381): threadid=9: thread exiting with uncaught exception (group=0x4018d760)
E/AndroidHarness( 3381): java.lang.RuntimeException: Ring buffer overflow
E/AndroidHarness( 3381): SEVERE AndroidHarness 16:44:07 Exception thrown in Thread[GLThread 10,5,main]: at com.jme3.util.RingBuffer.push(33)
E/AndroidHarness( 3381): at com.jme3.input.android.AndroidInput.generateEvents(534)
E/AndroidHarness( 3381): at com.jme3.input.android.AndroidInput.update(459)
E/AndroidHarness( 3381): at com.jme3.input.InputManager.update(846)
E/AndroidHarness( 3381): at com.jme3.app.Application.update(598)
E/AndroidHarness( 3381): at com.jme3.app.SimpleApplication.update(233)
E/AndroidHarness( 3381): at GestureGame.TestGame.update(2322)
E/AndroidHarness( 3381): at com.jme3.system.android.OGLESContext.onDrawFrame(412)
E/AndroidHarness( 3381): at android.opengl.GLSurfaceView$GLThread.guardedRun(1429)
E/AndroidHarness( 3381): at android.opengl.GLSurfaceView$GLThread.run(1184)

It happens when I touch the screen several times with all my ten fingers.
Any idea why it happens?
Thanks! :slight_smile:

Somehow you managed to generate more than 1024 events before they’ve been handled…

I committed a check to avoid this overflow.
Just know that all the events over 1024 are discarded and ignored.

This is my code:
.
.
inputManager.addMapping(“Touch”, new TouchTrigger(0));
inputManager.addListener(simpleTapListener, “Touch”);

And the listener:

[java]
private TouchListener simpleTapListener = new TouchListener() {
public void onTouch(String name, TouchEvent event, float tpf) {
/String eventType=""+event.getType();
if(!preTest && !(eventType.equals(“SCROLL”) && prev_event.equals(“SCROLL”)) && !(eventType.equals(“SCALE”) && prev_event.equals(“SCALE”)) )
happenedEvents.add(""+eventType);
prev_event=eventType;
/
int prev_ocurrencias = eventosOcurrencias.get(event.getType());
eventosOcurrencias.put(event.getType(), prev_ocurrencias+1);

        if(!interact){
            interact= true;
            timeFirstInteraction = System.currentTimeMillis() - initTime;
            firstInteract=true;
        }
        //System.out.println(firstInteract);
        //System.out.println(event.getType());
        
            switch (event.getType()) {
                case TAP:
                    
                    CollisionResults results2 = new CollisionResults();
                    // Convert screen click to 3d position
                    Vector2f click2d2 = inputManager.getCursorPosition();
                    Vector3f click3d2 = cam.getWorldCoordinates(new Vector2f(click2d2.x, click2d2.y), 0f).clone();

                    Vector3f dir2 = cam.getWorldCoordinates(new Vector2f(click2d2.x, click2d2.y), 1f).subtractLocal(click3d2).negate();
                    dir2.y = -dir2.y;
                    Ray ray2 = new Ray(click3d2, dir2);
                    // Collect intersections between ray and all nodes in results list.
                    rootNode.collideWith(ray2, results2);
                    if (results2.size() > 1) {
                        // The closest result is the target that the player picked:
                        Geometry target2 = results2.getClosestCollision().getGeometry();
                        // Here comes the action:
                        if (!simpleTapDone && target2.equals(object_geo1)) {
                            simpleTapDone = true;
                            //Material m = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
                            //m.setColor("Color", ColorRGBA.Green);
                            if(!preTest){
                                    finalTime = System.currentTimeMillis();
                                    //addNextLabel();
                                    tests.add(new Test(TestOptions.SIMPLE_TAP, finalTime - initTime, ""+id_sujeto, eventosOcurrencias,timeFirstInteraction));
                                    System.out.println("New test : Tab, " + (finalTime - initTime)+"FIRST ="+timeFirstInteraction);
                                   // makeSimpleTapTest = true;
                                    setText("Correcto!",0);
                                    initTime=0;
                                }
                                else
                                    setText("Correcto!",0);
                            starsExplosion();
                            playAudio();
                        }
                        else if(preTest){                    
                        if (target2.equals(retry_geo)) {
                            //setText("PreTest - Tab",0);
                            options = new TestOptions(TestOptions.SIMPLE_TAP);
                            simpleTapDone = false;
                            initSimpleTapTest();
                        }
                        else if(target2.equals(init_experiment_geo)){
                            try{
                                rootNode.detachChild(retry_geo);
                                rootNode.detachChild(init_experiment_geo);
                            }catch(Exception e){
                                ;
                            }
                            makeSimpleTapTest=true;
                            preTest=false;
                            
                            
                        }
                    }
                        else if(target2.equals(next_geo)){
                            if(simpleTapDone){
                                stopAudio();
                            }
                            else{
                                initTime = 0;
                                setText("No lo has conseguido!",0);
                                tests.add(new Test(TestOptions.SIMPLE_TAP, -1,""+id_sujeto,eventosOcurrencias,timeFirstInteraction));
                                initTime=0;
                                System.out.println("New test : SimpleTap, -1");
                            }
                            makeSimpleTapTest = true;
                        }
                        
                }
                break;
                case DOWN:
                    if(firstInteract){
                        CollisionResults results3 = new CollisionResults();
                        // Convert screen click to 3d position
                        Vector2f click2d3 = inputManager.getCursorPosition();
                        Vector3f click3d3 = cam.getWorldCoordinates(new Vector2f(click2d3.x, click2d3.y), 0f).clone();

                        Vector3f dir3 = cam.getWorldCoordinates(new Vector2f(click2d3.x, click2d3.y), 1f).subtractLocal(click3d3).negate();
                        dir3.y = -dir3.y;
                        Ray ray3 = new Ray(click3d3, dir3);
                        // Collect intersections between ray and all nodes in results list.
                        rootNode.collideWith(ray3, results3);
                        if (results3.size() > 1) {
                            // The closest result is the target that the player picked:
                            Geometry target3 = results3.getClosestCollision().getGeometry();
                            // Here comes the action:
                            if (target3.equals(next_geo)) 
                                timeFirstInteraction=-1;
                        }
                    }
                    break;
                case LONGPRESSED:
                    playNegativeFeedback();
                    break;
                case UP:
                    if(!simpleTapDone){
                        CollisionResults results3 = new CollisionResults();
                        // Convert screen click to 3d position
                        Vector2f click2d3 = inputManager.getCursorPosition();
                        Vector3f click3d3 = cam.getWorldCoordinates(new Vector2f(click2d3.x, click2d3.y), 0f).clone();

                        Vector3f dir3 = cam.getWorldCoordinates(new Vector2f(click2d3.x, click2d3.y), 1f).subtractLocal(click3d3).negate();
                        dir3.y = -dir3.y;
                        Ray ray3 = new Ray(click3d3, dir3);
                        // Collect intersections between ray and all nodes in results list.
                        rootNode.collideWith(ray3, results3);
                        if (results3.size() > 1) {
                            // The closest result is the target that the player picked:
                            Geometry target3 = results3.getClosestCollision().getGeometry();
                            // Here comes the action:
                            if (!target3.equals(next_geo)&&!target3.equals(object_geo1)&&!target3.equals(init_experiment_geo)&&!target3.equals(retry_geo))
                                playNegativeFeedback();
                        }
                    }
                    break;
                    
        }
            firstInteract= false;
            event.setConsumed();
            
    }
};

[/java]

1 Like