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

Crash with fullscreen(P3D) / Processing 3.1 #4468

Closed
knupel opened this issue May 11, 2016 · 20 comments
Closed

Crash with fullscreen(P3D) / Processing 3.1 #4468

knupel opened this issue May 11, 2016 · 20 comments
Labels

Comments

@knupel
Copy link

knupel commented May 11, 2016

I write a complex code, who use sometime size, sometime fullscreen.
the program work perfectly with size(,,P3D) but crash 99% of the time with fullscreen(P3D) ;
I try all my last two day I reproduce this bug in something simple to post it, but I fail to do that
So the error message :

java.lang.RuntimeException: Waited 5000ms for: <6b277f8f, 65e08c9b>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1>
    at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:449)
    at java.lang.Thread.run(Thread.java:745)

The bug is the same with Processing 3.0.2

I try to continue to find a simple code to isolate the bug !

@knupel
Copy link
Author

knupel commented May 11, 2016

Plus Processing crash not all the time at the same line in the program

@benfry benfry added the opengl label May 11, 2016
@knupel
Copy link
Author

knupel commented May 12, 2016

I understand nothing what happen with fullscreen() sometimes that's work, sometime no.
For example I add a println to check the step in the program, I run and after that's work fine, I remove the println, I run that's work...and after five run good, crash.
It's like a random crash on the big program
Not sure that can help but just In case the link of the random-crash-code :
https://www.dropbox.com/s/y5pv0loifj538v4/Scene_30_random_crash_code.zip?dl=0

@gohai
Copy link
Contributor

gohai commented May 15, 2016

@StanLepunK Are you running this on the Raspberry Pi or an ARM device perhaps?

@knupel
Copy link
Author

knupel commented May 15, 2016

nop, sorry only test on mac OSX. I don't use Raspberry Pi or ARM
it's often with fullscreen, and always with the first run with size().
But I don't find why that's happen, may be because I use video. very very weird.

@JakubValtar
Copy link
Contributor

Sadly I can't reproduce your issue. Your sketch has 50 tabs and 15k lines of code and I didn't even manage to launch it when I got all the libraries because it does not compile.

If it works with simpler sketches, I would bet there is some problem somewhere in your sketch. Unless you provide some shorter example I'm sorry but I can't really help.

P.S.: I think you should move this to some better IDE like Eclipse or IntelliJ IDEA. It would make your life much easier.

@knupel
Copy link
Author

knupel commented May 22, 2016

I take my day to try to isolated the problem and write a simplest code to see where is the problem...but I just find a few tracks.
One is when I call two OSC

  osc_1 = new OscP5(this, 9000);
  osc_2 = new OscP5(this, 9001);

with a fullScreen()

but only in my huge code not in the simple one.
After that I disable each method step by step to find which one can make a bug in association with OSC and fullScreen() after few try the program run good. I think find the gulty method, and to be sure I re-activate the other method step by step and every thing work fine... it's crazy. It's like when Processing or Sublim Text work fine once it work fine for few next run... I continue my investigation.
One thing is pretty sure, it's when I use two canals for OSC and FullScreen...it's my little a tiny track to find a solution to isolated this weirdy buggy.

@JakubValtar
Copy link
Contributor

If that happens only when there are two OscP5, you may have problem with synchronization. I believe each OscP5 runs its own thread and both can be calling oscEvent at the same time. Try to make oscEvent synchronized like this:

void synchronized oscEvent(OscMessage receive) {
  ...
}

If it does not help, try to put received OscMessages into BlockingQueue and process them inside draw().

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

BlockingQueue<OscMessage> oscQueue = LinkedBlockingQueue<OscMessage>();

void oscEvent(OscMessage receive) {
  oscQueue.offer(receive);
}

void processOscEvent(OscMessage receive) {
  if(receive.addrPattern().equals("Controller")) {
    catchDataFromController(receive) ;
    splitDataButton() ;
    splitDataSlider() ;
    splitDataLoadSaveController() ;
  }
  if(receive.addrPattern().equals("Prescene")) {
    catchDataFromPrescene(receive) ;
    splitDataFromPrescene() ;
    splitDataLoadSavePrescene() ;
  }
}

void draw() {
  while (!oscQueue.isEmpty()) {
    OscMessage receive = oscQueue.poll();
    processOscEvent(receive);
  }
}

Otherwise I'm out of ideas.

@knupel
Copy link
Author

knupel commented May 22, 2016

Thanks a lot I try this solution asap. And keep in touch if that's resolve this problem of crash java.lang.RuntimeException: Waited 5000ms for: <7421852c, 7ae675d8>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1> at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:449) at java.lang.Thread.run(Thread.java:745)

@knupel
Copy link
Author

knupel commented May 22, 2016

That's change nothing !
for information you forget to write newin sentence BlockingQueue<OscMessage> oscQueue = new LinkedBlockingQueue<OscMessage>();
I have an other track. May be I must launch the Scene in first before all other sketches to have no problem of synchronization but not sure.
But I continu to don't understand why that's happen just with fullScreen() and not with size()

@JakubValtar
Copy link
Contributor

I think that I managed to reproduce your problem:

void setup() {
  size(300, 300, P3D);
  surface.setLocation(100, 100);
  try { Thread.sleep(6000); } catch (InterruptedException e) { }
}

You call surface.setLocation() and then you initialize your OSC, which probably takes more than 5 seconds to complete. JOGL then complains that it could not set the location for 5 seconds and it is giving up. In your setup(), try to call OSCSetup() first and size_scene() after it and I'm sure it will be alright.

@knupel
Copy link
Author

knupel commented May 22, 2016

The problem is solve with new ordering launch. Now if Scene is launching in first and OSC can wait the receive message quietly. I don't do a lot of opening to be sure if it's ok, but that's sound good. To be sure I will add your security to be sure. Thx a lot for to be take a time on it.
I close this issue ?

@JakubValtar
Copy link
Contributor

You're welcome.

@knupel
Copy link
Author

knupel commented May 23, 2016

@JakubValtar Now you saw and put your hand magic hands in a little part of my project you should add a tiny star on my project :) https://github.com/StanLepunK/ROMANESCO-Processing

@kasperkamperman
Copy link

I saw exactly this error in a project of a student of me on a Windows system. This happened when I combined the Arduino library and the OpenCV library. Turning on Arduino would throw this error.

I'll try if I can reproduce this, but to what is this error related? Has it to do with where you call the size() function?

Running your code, throws an error on osx as well. However what is this surface.setLocation() call? I can't find it in the Processing reference.

void setup() {
  size(300, 300, P3D);
  surface.setLocation(100, 100);
  try { Thread.sleep(6000); } catch (InterruptedException e) { }
}

@JakubValtar
Copy link
Contributor

@kasperkamperman The problem is that you block the main thread for more than 5 seconds after you call setLocation. Put the setLocation at the end of setup and the problem will go away. The long sleep is triggering JOGL's detection of blocked thread.

@kasperkamperman
Copy link

@JakubValtar The problem is that I don't use setLocation...
So probably something else is blocking the thread for more then 5 seconds.

I could reproduce the error on my mac as well with the following code (of course part of a bigger project).

import processing.serial.*;
import cc.arduino.*;
import processing.video.*;

Arduino arduino;
Capture video;

void setup() {

  size(1280,720, P2D);

  // remove one of the lines below (either one) and there is no error
  frameRate(25);
  video = new Capture(this); 
  arduino = new Arduino(this, Arduino.list()[0], 57600);
}

void draw() {
  background(0);
}

@kasperkamperman
Copy link

@JakubValtar Do you prefer I create a separate issue for this, because it doesn't completely relate to fullscreen(P3D)?

@JakubValtar
Copy link
Contributor

Sorry for not getting back to you earlier. The problematic call here is
frameRate(), it calls through to JOGL and you should not block the thread
afterwards. Put it at the end of setup() and it will be okay.

Let's keep it here for now and I will investigate what we can do and create
new issue if needed.

Thanks!

On Sat, 25 Jun 2016, 13:00 kasperkamperman, notifications@github.com
wrote:

@JakubValtar https://github.com/JakubValtar Do you prefer I create a
separate issue for this, because it doesn't completely relate to
fullscreen(P3D)?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#4468 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADB6ion132-9co7r7maLFIIIe5Cnov_Yks5qPQpGgaJpZM4IcQrI
.

micuat added a commit to micuat/Pathfinder that referenced this issue May 21, 2017
@appakabar
Copy link

Don't know if it can help somebody, I had the same issue (java.lang.RuntimeException: Waited 5000ms ).
I was saving a big image at each processing draw().
Fixed by putting the save method call in a new thread (I was inside a java class)
new Thread( () -> mysaveMethod() ).start();

sooda added a commit to sooda/graffathon19-demo-one-scene that referenced this issue Jul 31, 2019
Prevent a (presumably) rendering-related timeout by moving the
frameRate() call to the very end of setup(), after all the
time-consuming resource loading has finished. The call seems to start a
rendering thread that times out in five seconds.

If the setup function takes a long time after frameRate() (like on my
ancient laptop), this happens:

java.lang.RuntimeException: Waited 5000ms for: <b788508, 5bf6a17>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1>
	at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:410)
	at java.lang.Thread.run(Thread.java:748)

See processing/processing#4468 and/or just google
around for "Waited 5000ms" for more details. This "FPSAWTAnimator" doesn't seem
to be purely Processing-related:

- https://bugs.freedesktop.org/show_bug.cgi?id=103078
- http://forum.jogamp.org/Where-when-is-it-ok-to-call-setFullscreen-td4032828.html
- https://stackoverflow.com/questions/15817476/avoid-recursivelockimpl01unfairish-lock-runtimeexception-timeout

This appears to be the origin of the message:

https://github.com/sgothel/gluegen/blob/df9ff7f340a5ab4e07efc613f5f264eeae63d4c7/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java#L198

.. but the real problem would then be in FPSAWTAnimator, a part of JOGL,
that doesn't handle the timeout.
sooda added a commit to sooda/graffathon19-demo-one-scene that referenced this issue Jul 31, 2019
Prevent a (presumably) rendering-related timeout by moving the
frameRate() call to the very end of setup(), after all the
time-consuming resource loading has finished. The call seems to start a
rendering thread that times out in five seconds.

If the setup function takes a long time after frameRate() (like on my
ancient laptop), this happens:

java.lang.RuntimeException: Waited 5000ms for: <b788508, 5bf6a17>[count 2, qsz 0, owner <main-FPSAWTAnimator#00-Timer0>] - <main-FPSAWTAnimator#00-Timer0-FPSAWTAnimator#00-Timer1>
	at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:410)
	at java.lang.Thread.run(Thread.java:748)

See processing/processing#4468 and/or just google
around for "Waited 5000ms" for more details. This "FPSAWTAnimator" doesn't seem
to be purely Processing-related:

- https://bugs.freedesktop.org/show_bug.cgi?id=103078
- http://forum.jogamp.org/Where-when-is-it-ok-to-call-setFullscreen-td4032828.html
- https://stackoverflow.com/questions/15817476/avoid-recursivelockimpl01unfairish-lock-runtimeexception-timeout

This appears to be the origin of the message:

https://github.com/sgothel/gluegen/blob/df9ff7f340a5ab4e07efc613f5f264eeae63d4c7/src/java/jogamp/common/util/locks/RecursiveLockImpl01Unfairish.java#L198

.. but the real problem would then be in FPSAWTAnimator, a part of JOGL,
that doesn't handle the timeout.
doctea pushed a commit to doctea/vurfx that referenced this issue Apr 22, 2020
…ading all of processing/processing#4468 -- getting new error now, possibly need to delay start of attempted rendering until after project has initialised..?  or maybe just need to make sure that gfx buffers are initialise
@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
Projects
None yet
Development

No branches or pull requests

6 participants