processing-video icon indicating copy to clipboard operation
processing-video copied to clipboard

nullpointer : com.jogamp.common.util.awt.AWTEDTExecutor.invoke

Open processing-bugs opened this issue 11 years ago • 11 comments

Issue by h2oop Wednesday Jan 08, 2014 at 12:07 GMT Originally opened as https://github.com/processing/processing/issues/2302


Hi,

after a few months trying to find this error i only can assume this has to be a bug. Could somebody point me in a direction how to locate this nullpointer to be more concrete...

the sketch is to big to send. (plays movies, displays rss-feeds and twitters, etc...) using P3D as renderer. (Syphon in and out) on mac mini 2013 - OSX 10.8.5 - processing 2.1 on macbook Pro - OSX 10.9 - processing 2.1

The null pointer appears only after a few days running the sketch. The sketch is programmed to do stuff every half hour.... so no Nullpointer for lets say 99 times...and then suddenly ... bang ! ?

java.lang.RuntimeException: java.lang.NullPointerException 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:206) at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172) at javax.media.opengl.Threading.invoke(Threading.java:191) at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:528) at processing.opengl.PJOGL.requestDraw(PJOGL.java:637) at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1597) at processing.core.PApplet.run(PApplet.java:2177) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.NullPointerException at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1160) at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1153) at processing.core.PApplet.handleMethods(PApplet.java:1347) at processing.core.PApplet.handleDraw(PApplet.java:2345) at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:810) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:649) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:633) at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:1271) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1103) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:978) at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1282) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by codeanticode Wednesday Jan 08, 2014 at 16:16 GMT


Looking at the stack trace, seems that the NPE originates from the following line

processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1160)

in Processing. Do you register any event handling methods in your sketch?

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by h2oop Thursday Jan 09, 2014 at 12:24 GMT


tnx for the tip… really appreciated.

I use

  • movieEvent(Movie m) - Backgroundloop + folder with different movies...
  • serialEvent(Serial myPort) - GPIO from Arduino
  • netEvent(XMLRequest ml) - getting 4 xml-feeds from the net
  • oscEvent(OscMessage OscIn) - receiving OSC from VDMX

i didn’t split up the m.read() from the different movies (playing together in background and foreground) in the movieEvent. Hopefully this was the problem....

I ll keep you updated on this… Maybe not a bug then… but a stupidity...

void movieEvent(Movie m) { if (m==movie1){ movie1.read(); } else if (m==movie2){ movie2.read(); } else if (m==movie3){ movie3.read(); } }

On 08 Jan 2014, at 17:16, codeanticode [email protected] wrote:

Looking at the stack trace, seems that the NPE originates from the following line

processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1160)

in Processing. Do you register any event handling methods in your sketch?

— Reply to this email directly or view it on GitHub.

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by codeanticode Sunday Jan 26, 2014 at 14:36 GMT


You shouldn't need the if/else structure in movieEvent, the read() method will be called on the appropriate Movie object. Do you still see this problem in 2.1.1?

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by h2oop Sunday Jan 26, 2014 at 19:33 GMT


looks fine for now.

but this error came after a few days… i let you know if it happens again…

On 26 Jan 2014, at 15:37, codeanticode [email protected] wrote:

You shouldn't need the if/else structure in movieEvent, the read() method will be called on the appropriate Movie object. Do you still see this problem in 2.1.1?

— Reply to this email directly or view it on GitHub.

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by segabor Sunday Feb 02, 2014 at 12:37 GMT


I'm having the same issue. It occurs when SMT lib is enabled.

Stack trace:


java.lang.RuntimeException: java.lang.NullPointerException 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:206) at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172) at javax.media.opengl.Threading.invoke(Threading.java:191) at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:541) at processing.opengl.PJOGL.requestDraw(PJOGL.java:688) at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1623) at processing.core.PApplet.run(PApplet.java:2177) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.NullPointerException at processing.opengl.PJOGL.getError(PJOGL.java:1700) at processing.opengl.PGraphicsOpenGL.report(PGraphicsOpenGL.java:5355) at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:1640) at vialab.SMT.SMTTouchManager.handleTouches(SMTTouchManager.java:40) at vialab.SMT.SMT.pre(SMT.java:1066) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1160) at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1153) at processing.core.PApplet.handleMethods(PApplet.java:1347) at processing.core.PApplet.handleDraw(PApplet.java:2297) at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:862) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:652) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:636) at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1284) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1106) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:981) at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1295) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)


processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by codeanticode Sunday Feb 02, 2014 at 23:16 GMT


Ok, thanks for the update, I'm able to reproduce the crash with the SMT library using the latest revision (which includes the most recent jogl stable release). I see you opened an issue in the SMT repo, I will make a note over there to check if they need help with it.

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by segabor Monday Feb 03, 2014 at 08:34 GMT


Thank you!

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by h2oop Wednesday Feb 05, 2014 at 16:04 GMT


I have a new one… again … no clue where to look…

Is it possible that the graphic card of the Mac Mini (6 month old) is not strong enough to handle the openGL ? Or does the NPE points me to a code-bug (or miscoding) .

Hoping it is a code-bug…


java.lang.RuntimeException: java.lang.NullPointerException 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:206) at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172) at javax.media.opengl.Threading.invoke(Threading.java:191) at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:541) at processing.opengl.PJOGL.requestDraw(PJOGL.java:688) at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1623) at processing.core.PApplet.run(PApplet.java:2177) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.NullPointerException at java.util.LinkedList.unlink(LinkedList.java:209) at java.util.LinkedList.remove(LinkedList.java:524) at processing.opengl.Texture.bufferUpdate(Texture.java:917) at processing.opengl.PGraphicsOpenGL.getTexture(PGraphicsOpenGL.java:6082) at processing.opengl.PGraphicsOpenGL$TexCache.getTexture(PGraphicsOpenGL.java:6848) at processing.opengl.PGraphicsOpenGL.flushPolys(PGraphicsOpenGL.java:2423) at processing.opengl.PGraphicsOpenGL.flush(PGraphicsOpenGL.java:2374) at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:1684) at processing.core.PApplet.handleDraw(PApplet.java:2326) at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:862) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:652) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:636) at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1284) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1106) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:981) at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1295) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) On 03 Feb 2014, at 09:34, Gábor Sebestyén [email protected] wrote:

Thank you!

— Reply to this email directly or view it on GitHub.

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by kiwistrongis Thursday Feb 06, 2014 at 21:47 GMT


Hey guys, I have the source of the bug, more or less. If I'm right, it happens when PGraphicsOpenGL calls are made in the wrong thread. The null pointer exception happens before the wrong thread warning because in the thread check happened after a call that depended on being in the right thread. This commit fixes that, but another null pointer exception occurs immediately afterwards, for what seems like the same reason. Idk if this is related, but in our library (and thus my tests) this is happening when using frame buffers.

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Comment by lthben Thursday May 22, 2014 at 02:49 GMT


hi, I had the exact same error message as what h2oop posted on Feb 6. I was using Processing 2.1.1 on Windows 7. My program uses a lot of png files, moving them around around on screen. I use P2D as my renderer. I also use serialEvent() and movieEvent(). The program would randomly crash even when on idle mode when there is no user action, when the image files are moving around. I was on panic mode as the program was due for a permanent exhibition launch in a few weeks. Fortunately, when I upgraded all my Processing libraries to the Processing 2.2 stable version, this error which caused my program to crash went away. Just thought of posting it here to let you guys know.

processing-bugs avatar Jul 22 '14 21:07 processing-bugs

Hi,

I'm experiencing the same NullPointerException when running a simple sketch like the Loop example in Processing 2.1-2.2.1 on Windows for a long time (6 hours and more) with large video (e.g. FullHD). It has not happened on a Linux machines so far which leads me to the same conclusion as kiwistrongis, that it is a threading issue.

I've been able to bypass this problem, by using a separate PImage object for each Movie object and synchronization - Movie object loads pixels by m.read(), then copies all pixels to a PImage object, that get drawn using image() - see below.

The drawback is a performance hit due to the load/updatePixels and pixels copying, but in my case (1 FullHD video) it was insignificant.

Modified Processing example:

import processing.video.*;

Movie movie;
PImage movieImage;

void setup() {
  size(640, 360);
  background(0);
  // Load and play the video in a loop
  movie = new Movie(this, "transit.mov");
  movie.loop();
}

// do not use this method - keep it commented out
//void movieEvent(Movie m) {
//  m.read();
//}

void draw() {
  // I use the synchronization here to avoid multiple calls to draw 
  // before it finishes

  synchronized(this) {  
    if (movie.available()) {
      //loads a new frame
      movie.read();
      if (movieImage==null) {
        // delayed initialization, because until the first frame is read
        // the movie object does not now its size
        movieImage=createImage(movie.width, movie.height, RGB);
        movieImage.loadPixels();
      }
      movie.loadPixels();
      //copies pixels to a PImage 
      System.arraycopy(movie.pixels, 0, movieImage.pixels, 0, movie.pixels.length);
      movieImage.updatePixels();
    }
    if (movieImage!=null) {
      //draw the image/video
      image(movieImage, 0, 0, width, height);
    }
  }
}

I've also made a Java wrapper class around Movie object to make it easier for me to use Movie - http://pastebin.com/nEZ0hY8P.

I'm currently testing a "multithreaded" version, that employs the movieEvent() method, so that the pixel copying might be done in a different thread, but I yet cannot say if it runs for a longer time.

wildman007 avatar Sep 18 '14 14:09 wildman007