Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing left on event queue. #4945

Closed
MLanghof opened this issue Mar 6, 2017 · 2 comments
Closed

Nothing left on event queue. #4945

MLanghof opened this issue Mar 6, 2017 · 2 comments

Comments

@MLanghof
Copy link

MLanghof commented Mar 6, 2017

I'm using noLoop() in my sketch and redraw() whenever I have to, which includes mouse interaction. (I use this approach since redraws may be expensive, although this error just happened for a pretty lightweight redraw).

Very occasionally (~once every 10-20 minutes of program usage) I get the following error when I'm performing some action with the mouse that causes a redraw:

java.lang.RuntimeException: Nothing left on the event queue.
	at processing.core.PApplet$InternalEventQueue.remove(PApplet.java:2582)
	at processing.core.PApplet.dequeueEvents(PApplet.java:2614)
	at processing.core.PApplet.postEvent(PApplet.java:2607)
	at processing.opengl.PSurfaceJOGL.nativeMouseEvent(PSurfaceJOGL.java:1139)
	at processing.opengl.PSurfaceJOGL$NEWTMouseListener.mouseDragged(PSurfaceJOGL.java:1034)
	at jogamp.newt.WindowImpl.dispatchMouseEvent(WindowImpl.java:4136)
	at jogamp.newt.WindowImpl.consumePointerEvent(WindowImpl.java:3981)
	at jogamp.newt.WindowImpl.consumeEvent(WindowImpl.java:3376)
	at jogamp.newt.WindowImpl.doEvent(WindowImpl.java:3318)
	at jogamp.newt.WindowImpl.doPointerEvent(WindowImpl.java:3766)
	at jogamp.newt.WindowImpl.doMouseEvent(WindowImpl.java:3426)
	at jogamp.newt.WindowImpl.sendMouseEvent(WindowImpl.java:3393)
	at jogamp.newt.driver.windows.DisplayDriver.DispatchMessages0(Native Method)
	at jogamp.newt.driver.windows.DisplayDriver.dispatchMessagesNative(DisplayDriver.java:124)
	at jogamp.newt.DisplayImpl.dispatchMessages(DisplayImpl.java:753)
	at jogamp.newt.DisplayImpl$7.run(DisplayImpl.java:672)
	at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:347)

In this case, it happened the moment I started to drag the mouse (while holding LMB). Here are the functions in my applet reacting to mouse input:

void mouseClicked()
{
  processor.handleClick(mouseX, mouseY);
  // Doesn't redraw
}

void mouseWheel(MouseEvent event)
{
  zoom(event.getCount());
  redraw();
}

void mouseDragged()
{
  if (mouseButton == LEFT) {
    panX -= pmouseX - mouseX;
    panY -= pmouseY - mouseY;
  }
  redraw();
}

void mouseReleased()
{
  redraw();
}

Looking at the relevant code, I'm under the impression that multiple events (mouse down and mouse dragged?) get thrown onto the queue and then immediately dequeued from different threads, which InternalEventQueue doesn't guard against. The symptoms definitely yell "race condition", too.

I'd like to note that I'm not doing any threading in my application.

@MLanghof
Copy link
Author

Most likely fixed by #4998, closing for now.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant