BufferChecks, IllegalArgumentException - intermittent crash

I keep getting this error, intermittently. Is this a known problem with LWJGL in JME3? Sometimes I can run for a long time with no problems. Other times it happens fairly quickly.

Could it be a problem with the buffers that I feed into the Meshes I build? I suspect that, since everything is procedural in my code.

[java]Jan 13, 2014 3:11:30 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Number of remaining buffer elements is 1742142, must be at least 3145728. Because at most 3145728 elements can be returned, a buffer with at least 3145728 elements is required, regardless of actual returned element count
at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:162)
at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:189)
at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:230)
at org.lwjgl.opengl.GL11.glTexImage2D(GL11.java:2845)
at com.jme3.renderer.lwjgl.TextureUtil.uploadTexture(TextureUtil.java:352)
at com.jme3.renderer.lwjgl.LwjglRenderer.updateTexImageData(LwjglRenderer.java:1908)
at com.jme3.renderer.lwjgl.LwjglRenderer.setTexture(LwjglRenderer.java:1931)
at com.jme3.material.MatParamTexture.apply(MatParamTexture.java:86)
at com.jme3.material.Material.render(Material.java:1088)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:523)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:322)
at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:374)
at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:763)
at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:719)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:983)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:695)[/java]

Are you modifying buffers (texture buffers in this case) from another thread or something? Or maybe the limit is set strangely.

Since it’s intermittent it will be hard to track down but I’ve never seen this error before and I update buffers (both mesh and textures) all the time without issue.

There is a lot of threading going on. I just realized that I do not have a true real-time event handler as part of my global event manager. The side-effect of this is that some things that should happen on the same thread, (rendering-related), are essentially happening on the EventManager thread. This can (intermittently) cause issues.

Thanks! Will let you know how it works out.