question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The Map View constantly resets itself

See original GitHub issue

Prerequisites

Description

Resizing the Map View forces it to completely reset itself - this gives you a way to deal with some GL related issues that can occur. I have noticed on certain displays that the Map View gets into a state where it constantly resets itself, making it impossible to use.

An exception when you continuously resize the map view is the following exception: SEVERE [global] java.lang.RuntimeException: Number of texture units not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help. at processing.opengl.PGL.bindTexture(PGL.java:3235) at processing.opengl.Texture.allocate(Texture.java:1147) at processing.opengl.Texture.init(Texture.java:213) at processing.opengl.Texture.<init>(Texture.java:171) at processing.opengl.PGraphicsOpenGL.loadTextureImpl(PGraphicsOpenGL.java:5921) at processing.opengl.PGraphicsOpenGL.initOffscreen(PGraphicsOpenGL.java:6602) at processing.opengl.PGraphicsOpenGL.beginOffscreenDraw(PGraphicsOpenGL.java:6654) at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:1461) at de.fhpotsdam.unfolding.mapdisplay.Java2DMapDisplay.draw(Java2DMapDisplay.java:351) at de.fhpotsdam.unfolding.UnfoldingMap.draw(UnfoldingMap.java:366) at au.gov.asd.tac.constellation.mapview.MapViewTileRenderer.draw(MapViewTileRenderer.java:525) at processing.core.PApplet.handleDraw(PApplet.java:2437) at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:859) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759) at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81) at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452) at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178) at java.util.TimerThread.mainLoop(Timer.java:555) [catch] at java.util.TimerThread.run(Timer.java:505) {code} {code:java} SEVERE [global] java.lang.NullPointerException at au.gov.asd.tac.constellation.display.renderer.batcher.Batch.connectIntBuffer(Batch.java:475) at au.gov.asd.tac.constellation.display.renderer.batcher.IconBatcher.lambda$updateIcons$1(IconBatcher.java:122) at au.gov.asd.tac.constellation.display.renderer.batcher.SceneBatcher.lambda$updateIntBufferTask$0(SceneBatcher.java:160) at au.gov.asd.tac.constellation.display.renderer.GraphRenderable.lambda$addTaskIfReady$0(GraphRenderable.java:115) at au.gov.asd.tac.constellation.display.renderer.GraphRenderable.lambda$update$29(GraphRenderable.java:376) at java.util.ArrayList.forEach(Unknown Source) at au.gov.asd.tac.constellation.display.renderer.GraphRenderable.update(GraphRenderable.java:375) at au.gov.asd.tac.constellation.display.renderer.GLRenderer.lambda$display$2(GLRenderer.java:164) at java.util.ArrayList.forEach(Unknown Source) at au.gov.asd.tac.constellation.display.renderer.GLRenderer.display(GLRenderer.java:163) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at com.jogamp.opengl.awt.GLCanvas$11.run(GLCanvas.java:1424) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) Caused: com.jogamp.opengl.GLException: Caught NullPointerException: null on thread AWT-EventQueue-0 at com.jogamp.opengl.GLException.newGLException(GLException.java:76) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1438) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused: java.lang.RuntimeException at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58) at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103) at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:201) at com.jogamp.opengl.Threading.invokeOnOpenGLThread(Threading.java:202) at com.jogamp.opengl.Threading.invoke(Threading.java:221) at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:505) at au.gov.asd.tac.constellation.display.renderer.GLVisualProcessor.performVisualUpdate(GLVisualProcessor.java:195) at au.gov.asd.tac.constellation.visualsupport.display.VisualProcessor.lambda$update$0(VisualProcessor.java:211)

The Map view can caused Constellation to run sluggishly and can do with a revisit to how things could be improved. An immediate improvement would be to not have the map view reload continuously as it is being resized.

Related stack trace java.lang.RuntimeException: Waited 5000ms for: <6494c6f7, 21965401>[count 2, qsz 0, owner <AWT-EventQueue-0-FPSAWTAnimator#00-Timer0>] - <AWT-EventQueue-0-Display-.windows_nil-1-EDT-1> at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198) at jogamp.newt.WindowImpl.setVisibleActionImpl(WindowImpl.java:1234) at jogamp.newt.WindowImpl$VisibleAction.run(WindowImpl.java:1318) at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:145) at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:375) Caused: java.lang.RuntimeException at jogamp.newt.DefaultEDTUtil.invokeImpl(DefaultEDTUtil.java:252) at jogamp.newt.DefaultEDTUtil.invoke(DefaultEDTUtil.java:165) at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:442) at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2782) at jogamp.newt.WindowImpl.setVisible(WindowImpl.java:1330) at jogamp.newt.WindowImpl.setVisible(WindowImpl.java:1335) at com.jogamp.newt.opengl.GLWindow.setVisible(GLWindow.java:578) at com.jogamp.newt.awt.NewtCanvasAWT.detachNewtChild(NewtCanvasAWT.java:1099) at com.jogamp.newt.awt.NewtCanvasAWT.destroyImpl(NewtCanvasAWT.java:701) at com.jogamp.newt.awt.NewtCanvasAWT.removeNotify(NewtCanvasAWT.java:660) at java.awt.Container.remove(Unknown Source) at java.awt.Container.remove(Unknown Source) at javax.swing.JViewport.remove(Unknown Source) at javax.swing.JViewport.setView(Unknown Source) at javax.swing.JScrollPane.setViewportView(Unknown Source) at au.gov.asd.tac.constellation.mapview.MapViewTopComponent.lambda$resetContent$37(MapViewTopComponent.java:498) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) [catch] at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Sourc) at java.awt.EventDispatchThread.run(Unknown Source)

Steps to Reproduce

  1. Open the Map View
  2. Click and drag the Map View pane to resize it horizontally repeatedly

Expected behaviour: The Map View resizes without an error or unnecessary CPU/GPU stress

Actual behaviour: The graphics card buffer fills up and causes Constellation to crash

Reproduces how often: 100%

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
arcturus2commented, Jan 23, 2020

@arcturus2 Do you think that this is the case?

@formalhaut69 great work persisting and debugging this. I’d agree that I think it is that the buffers are written to without clearing, causing it to overflow.

And if so, how could I potentially access the graphics buffer to clear it?

Not sure. The Map view is OpenGL bases as you’ve found however it uses a different implementation to the graph. The Map view uses Unfolding Maps which uses an OpenGL library called Processing.

Can you have a look at https://processing.org/reference/clear_.html and see if you can get access to the PGraphics object. There might be a call to do this from the Unfolding map classes and @cygnus-x-1 is the best person to help with that.

I’ll make a pull request so you can take a look at it.

Legend. I’ve done some testing and it’s looking much better.

1reaction
formalhaut69commented, Jan 22, 2020

@aldebaran30701 and I have been able to implement a delay of half a second so the map now refreshes at an acceptable rate. This does make it much more difficult to fill up the graphics buffer and cause a crash but it can still occur. So it appears to be only a partial solution and doesn’t solve the underlying problem. I think what the underlying issue is that the graphics buffer isn’t being cleared properly. This is just a guess because I don’t know how the buffer works but I’m assuming that it’s supposed to be filled up with tasks to complete. What seems to be occurring though, is that the tasks are being completed because the map view is being refreshed and so this leads me to believe that the buffer isn’t being emptied correctly. @arcturus2 Do you think that this is the case? And if so, how could I potentially access the graphics buffer to clear it? I’ll make a pull request so you can take a look at it.

// top component resize listener
        addComponentListener(new ComponentAdapter() {
            ScheduledExecutorService scheduledExecutorService =
                Executors.newScheduledThreadPool(1);
            ScheduledFuture scheduledFuture;
            @Override
            //Cancels the previous resize (future) and then performs the latest one every half second 
            public void componentResized(ComponentEvent event) {
                if(scheduledFuture != null) {
                    scheduledFuture.cancel(true);
                }
                scheduledFuture = scheduledExecutorService.schedule(() -> {
                    if (event.getComponent().getWidth() != cachedWidth
                            || event.getComponent().getHeight() != cachedHeight) {
                        cachedWidth = event.getComponent().getWidth();
                        cachedHeight = event.getComponent().getHeight();
                        resetContent();
                    }
                    return null;
                }, 500, TimeUnit.MILLISECONDS);
            }
        });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Maps Navigation restarting itself frequently - Reddit
The issue is: Once Google Maps Navigation has been used on the phone (and ended) it will randomly, and frequently, decide to "resume/restart" ......
Read more >
iphone - Mapkit - Zoom level keeps resetting - Stack Overflow
I've found that setting the region itself can change the zoom level slightly, even when telling the mapView to use the same region...
Read more >
How to fix Maps when it crashes - Android - Google Maps Help
Go to device Settings and then Apps. · Select Maps app. · Tap Storage and then Clear data.
Read more >
How to fix the bug of a Samsung mobile restarting when you ...
To fix this, just go to settings, go to apps, search for Maps in the app list, then click on it, then tap...
Read more >
How To Make A RESET SYSTEM for Your Minecraft Map! w
In this video I show you how to reset your bedwars map, and replace the bed! Works for Minecraft Bedrock, Pocket Edition, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found