Skip to content

64 attached or detached BulletAppStates with parallel threading causes JVM to crash #928

@James-Richardson

Description

@James-Richardson

If your game is routinely attaching and detaching BulletAppStates, once it attaches the 64th BulletAppState, the JVM crashes.

Note that the issue isn't that there are more than 64 BulletAppStates currently attached. The JVM crashes if more than 64 BulletAppStates have previously been attached, and even if the current number of attached BulletAppStates is far less than 64.

This issue can be reproduced with the following code, in which case only one BulletAppState is ever attached, but it is attached and detached more than 64 times:

    private int count;
    private int frame;
    private BulletAppState bulletAppState;
    
    @Override
    public void simpleInitApp() {}
    
    @Override
    public void simpleUpdate(float tpf) {
        if (frame % 4 == 0) {
            System.out.println(++count);
            
            bulletAppState = new BulletAppState();
            
            bulletAppState.setThreadingType(ThreadingType.PARALLEL);
            
            stateManager.attach(bulletAppState);
        } else if (frame % 4 == 2) {
            stateManager.detach(bulletAppState);
        }
        
        frame++;
    }

More information on this issue can be found in the original forum topic.

Metadata

Metadata

Assignees

Labels

PhysicsIssues with all kinds of Physics and their BindingsbugSomething that is supposed to work, but doesn't. More severe than a "defect".

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions