# Fullscreen with P2D hangs Ubuntu 18.04

**URL:** https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997
**Category:** Processing
**Created:** [September 15, 2019, 12:38am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997 "2019-09-15T00:38:28Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 15, 2019, 12:38am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/1 "2019-09-15T00:38:28Z")

</div>

I’m running Ubuntu 18.04 with an AMD Radeon R7 M445 GPU, the amdgpu drivers and Processing 3.5.1. When running a simple sketch like the one below, the entire system hangs after some time (70-120 seconds) and I have to power cycle the machine. Other than the solution (revert) of [this thread](https://discourse.processing.org/t/solved-p2d-p3d-sketches-wont-start-on-fresh-ubuntu-18-04-installation/3568), is there a fix (and reason) for this bug?

```auto
void setup(){
  fullScreen(P2D);
}

void draw(){
  background(0);
  text(millis(), 100, 100);
}

```

Btw, this only happens with `fullscreen(P2D);`. If I use `size(200, 200, P2D);` instead, it works normally.

Any help is appreciated and thank you in advance!

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [September 15, 2019, 1:36am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/2 "2019-09-15T01:36:47Z")

</div>

try on RPI 3B+ with current Raspbian Buster  
but use Processing 3.5.3 ( any reason you use 3.5.1 ? )  
no problem

 ![RPI3B%20_processing353](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c5fa9eac3455ec5af088b894e5f67947d3623893.jpeg)  
get 50 FPS  
 ![RPI3B%20_processing353_P2D_fullscreen](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/e2ec08c10fd180124baec9b4be5d815c421f54a5.png)

* * *

add i login remote SSH terminal

> htop

 ![RPI3B%20_processing353_P2D_fullscreen_htop0](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/ac595fbb693b44680abd99aa5509cfd8f7e818cb.png)

and after start your Processing sketch **could not see any memory leak**

 ![RPI3B%20_processing353_P2D_fullscreen_htop1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9f6bc14f448fc9feae29ed24417fe191f2262cee.png)  
note: pictures are screenshot from a Win10 PC

> you see the RPI desktop in a VNC window  
> and the terminal htop as overlay in a bitvise xterm window

---

<div class="post-metadata">

### Author: ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)
#### Post date: [September 15, 2019, 12:19pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/3 "2019-09-15T12:19:21Z")

</div>

I wonder how hard does it hang. It may be just the sketch hanging and locking the desktop environment, or the desktop environment itself hanging, or the X11 server hanging, or the entire Linux kernel screwing up. I had stuff locking up GNOME before on Ubuntu 18.04.

I think it’s reasonable to try see what it can be.

- Can you test it with other desktop environments (xfce4, KDE Plasma, whatever?)

- Can you log into a TTY by pressing CTRL+ALT+F2, and then try to run `killall -9 java` from there to force close Processing? (then CTRL+ALT+F1 or CTRL+ALT+F7 to return back)

- Can you ([turn on](https://askubuntu.com/questions/10622/how-can-i-enable-ctrlaltbackspace) and) test X11 zapping with CTRL+ALT+BACKSPACE in the middle of such a hang? It should drop you to the login screen.

- Can you ([turn on](https://askubuntu.com/questions/911522/how-can-i-enable-the-magic-sysrq-key-on-ubuntu-desktop) and) try the Magic SysRq sequence in the middle of such a hang? (i.e. holding ALT+PrintScreen and, without releasing them, pressing keys R,E,I,S,U,B one after another with a second or two of delay between each)

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 15, 2019, 3:23pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/4 "2019-09-15T15:23:26Z")

</div>

@kll There is no particular reason for 3.5.1 other than being kinda bored to update every minor version 😛.

@Architector_4 I was able to log into a TTY and kill Processing. So that is better than power-cycling.

But I still cannot figure out what is happening.  
P.S.: I’m specifying P2D in fullScreen so that it is true fullscreen. If you know any other way I can do this, it would eliminate the problem.

---

<div class="post-metadata">

### Author: ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)
#### Post date: [September 15, 2019, 3:57pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/5 "2019-09-15T15:57:24Z")

</div>

You should try with the latest version. Who knows, maybe it has this specific thing fixed?

This means that sketch itself hangs, and, therefore, locks up the desktop environment. Is this specific to `fullscreen(P2D);` exactly? Does the sketch hang after 70-120 seconds if you do something like `size(1920,1080, P2D);` i.e. not fullscreen, but with your screen size?

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 15, 2019, 4:54pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/6 "2019-09-15T16:54:57Z")

</div>

It hanged with `size(1920,1080, P2D);` as well. I tried with 3.5.3, same thing. Also many times TTY doesn’t work and I have to REISUB out of this.

---

<div class="post-metadata">

### Author: ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)
#### Post date: [September 15, 2019, 5:43pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/7 "2019-09-15T17:43:20Z")

</div>

Doesn’t work in what way? You can’t switch to it? ALT+PrintScreen+R is supposed to reset keyboard layout which might make CTRL+ALT+F2 work.

And if that doesn’t, maybe your system gets overloaded. Try launching such a sketch with a task manager open i.e. while watching RAM usage. If it peaks to 100%, then that should indicate a problem. In that case, ALT+PrintScreen+F manually triggers the Out Of Memory condition i.e. instantly kills the most memory hungry process, which should also be better than REISUB or hardware power cycling. Although you might need to press it several times, as it might first kill a few browser tabs or other applications depending on what you have other.

Also, when TTY doesn’t work, does CTRL+ALT+Backspace (to kill X11) work?

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 15, 2019, 6:21pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/8 "2019-09-15T18:21:26Z")

</div>

Yes it does not switch to it (sorry for being unclear). Or sometimes it tries to switch to it (screen goes all black) but never quite gets there.

Something I just noticed, RAM usage does not seem normal to me!! When I run the sketch above with the task manager open as you suggested, I see the memory usage going up significantly. For that sketch, it starts at ~100MiB and during the first two minutes it goes up to ~150MiB. If I run the sketch below, the situation becomes more interesting, as memory usage starts at 130MiB and after one minute it reaches almost 700MiB (hangs at 730-740MiB).

```auto
void setup(){
  fullScreen(P2D);
}

void draw(){
  background(0);
  fill(255);
  textFont(createFont("Calibri", 38));
  text(millis(), 100, 100);
}

```

During this experiment for example, nothing short of REISUB worked.

---

<div class="post-metadata">

### Author: ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)
#### Post date: [September 15, 2019, 6:48pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/9 "2019-09-15T18:48:04Z")

</div>

How much RAM do you have? Do JAVA2D, P3D, FX2D modes also hang your system?

Can you test with other desktop environments?

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 15, 2019, 7:10pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/10 "2019-09-15T19:10:39Z")

</div>

8 GB RAM. JAVA2D and FX2D are working normally, P3D also skyrockets memory usage.

Sorry, can’t test with other environments.

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 15, 2019, 10:03pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/11 "2019-09-15T22:03:05Z")

</div>

Also, on the same machine in Windows 10, Java 8 and Processing 3.3.5, memory usage skyrockets again (it reaches several GB).

In Ubuntu I have jdk 11.

What is so wrong with P2D??

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [September 15, 2019, 11:27pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/12 "2019-09-15T23:27:00Z")

</div>

> [@Alex\_Pr](#):
>
> `textFont(createFont("Calibri", 38));`

Do not use **createFont()** in **draw()**! As most assets, do them all only once in **setup()**. ⚠

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [September 16, 2019, 10:02am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/13 "2019-09-16T10:02:19Z")

</div>

Ubuntu 18.04 with amdgpu and Processing 3.5.3 here. But an RX 560 which I think is next generation from yours? Original sketch works fine without problem.

Are you using the default Processing install? You mention JDK 11 - why? Are you using Processing with system JDK? (I assume not since P2D, well JOGL, hard crashes with stock OpenJDK 11 on Ubuntu anyway, although works fine with other ones).

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 16, 2019, 11:24am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/14 "2019-09-16T11:24:40Z")

</div>

@neilcsmith Yes I am using the default install. I just checked which version is installed in the system through the terminal, not sure if that’s the one Processing uses (can I check that?). I haven’t done anything weird though, just the regular processing installation.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [September 16, 2019, 11:26am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/15 "2019-09-16T11:26:59Z")

</div>

> [@Alex\_Pr](#):
>
> Yes I am using the default install. I just checked which version is installed in the system through the terminal, not sure if that’s the one Processing uses (can I check that?).

There is a JDK inside the Processing install. Unless you go out of your way to use another one, it will use the one it ships with.

OTOH, I am pointing it at the system installed OpenJDK 8, which might be a cause of difference, but unlikely.

Which desktop and display server (X11 / Wayland) are you using?

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [September 16, 2019, 11:34am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/16 "2019-09-16T11:34:43Z")

</div>

> [@Alex\_Pr](#):
>
> the one Processing uses (can I check that?)

try

```auto
  println( "__SYS INFO :");
  println( "System : " + System.getProperty("os.name") + " " + System.getProperty("os.version") + " " + System.getProperty("os.arch") );
  println( "JAVA : " + System.getProperty("java.home") + " rev: " +javaVersionName);

```

on my RPI see in terminal

```auto
pi@RPI:~ $ java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-post-Raspbian-5)
OpenJDK Server VM (build 11.0.3+7-post-Raspbian-5, mixed mode)
pi@RPI:~ $ 

```

processing 3.5.3 say

```auto
__SYS INFO :
System : Linux 4.19.66-v7+ arm
JAVA : /usr/local/lib/processing-3.5.3/java rev: 1.8.0_202

```

so processing is delivered and using its internal JAVA 8

* * *

> **p-bench ( full code )**
>
> ```auto
> float rset=120, r;
> int x = 0;
> int w = 400;
> int h = 200;
> int grid=20, many = grid*grid;
> boolean stressenable=true;
> 
> void settings() {
> size(w, h); // default use JAVA2D 
> // not on RPI size(w, h,FX2D);
> // size(w, h,P2D);
> // size(w, h,P3D);
> }
> 
> void setup() {
> frameRate(rset);
> println("target "+rset+" FPS");
> background(200, 200, 0);
> println("use key [p] for sysinfo, [n] numinfo, \n[s] stresstest ( "+grid+"*"+grid+" = "+many+" ) points, [+][-] grid +-5" );
> }
> 
> void draw() {
> surface.setTitle("SYS INFO "+ nf(r, 0, 1)+" FPS" );
> if ( stressenable ) stress();
> r = frameRate;
> if ( r > 30 ) stroke(0, 200, 0); 
> else stroke(200, 0, 0);
> line(x, height-2, x, height-2-r); // FPS graph
> x++;
> if ( x > width ) { 
> x = 0; 
> background(200, 200, 0);
> }
> }
> 
> void stress() {
> push();
> for ( int i=0; i<grid; i++) {
> for ( int j=0; j<grid; j++) {
> stroke(0, 255-random(255), random(255) );
> point(5+i, 5+j);
> }
> }
> pop();
> }
> 
> void sysinfo() {
> println( "__SYS INFO :");
> println( "System : " + System.getProperty("os.name") + " " + System.getProperty("os.version") + " " + System.getProperty("os.arch") );
> println( "JAVA : " + System.getProperty("java.home") + " rev: " +javaVersionName);
> //println( System.getProperty("java.class.path") );
> //println( "\n" + isGL() + "\n" );
> println( "OPENGL : VENDOR " + PGraphicsOpenGL.OPENGL_VENDOR+" RENDERER " + PGraphicsOpenGL.OPENGL_RENDERER+" VERSION " + PGraphicsOpenGL.OPENGL_VERSION+" GLSL_VERSION: " + PGraphicsOpenGL.GLSL_VERSION);
> println( "user.home : " + System.getProperty("user.home") );
> println( "user.dir : " + System.getProperty("user.dir") );
> println( "user.name : " + System.getProperty("user.name") );
> println( "sketchPath : " + sketchPath() );
> println( "dataPath : " + dataPath("") );
> println( "dataFile : " + dataFile("") );
> println( "frameRate : target "+nf(rset, 0, 1)+" actual "+nf(r, 0, 1));
> println( "canvas : width "+width+" height "+height+" pix "+(width*height));
> }
> 
> void numinfo() {
> println( "__NUM INFO :");
> println( "byte min: "+Byte.MIN_VALUE+ "\t\t\t max: "+Byte.MAX_VALUE);
> println( "short min: "+Short.MIN_VALUE+ "\t\t\t max: "+Short.MAX_VALUE);
> println( "int min: "+Integer.MIN_VALUE+"\t\t max: " +Integer.MAX_VALUE);
> println( "long min: "+Long.MIN_VALUE+ "\t max: " +Long.MAX_VALUE);
> println( "float min: "+Float.MIN_VALUE+ "\t\t\t max: "+Float.MAX_VALUE);
> println( "double min: "+Double.MIN_VALUE+ "\t\t\t max: "+Double.MAX_VALUE);
> }
> 
> void keyPressed() {
> if ( key == 'p' ) sysinfo();
> if ( key == 'n' ) numinfo();
> if ( key == 's' ) stressenable = ! stressenable;
> if ( key == '+' ) {
> grid +=5;
> many = grid*grid;
> println("stresstest ( "+grid+"*"+grid+" = "+many+" ) points" );
> }
> if ( key == '-' ) {
> grid -=5;
> many = grid*grid;
> println("stresstest ( "+grid+"*"+grid+" = "+many+" ) points" );
> }
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 16, 2019, 11:53am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/17 "2019-09-16T11:53:20Z")

</div>

@neilcsmith GNOME & X11

@kll Thank you. I get

```auto
Linux 4.15.0-54-generic amd64
/opt/processing-3.5.1/java rev: 1.8.0_202

```

With your p-bench though, all OPENGL fields are null.

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [September 16, 2019, 11:54am UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/18 "2019-09-16T11:54:31Z")

</div>

-a- means you still use 3.5.1  
-b- but the processing internal JAVA 8 works fine

* * *

OPEN GL:  
ok, try again with using

```auto
size(w, h,P2D);

```

---

<div class="post-metadata">

### Author: ![Alex\_Pr](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Alex\_Pr](https://discourse.processing.org/u/Alex_Pr)
#### Post date: [September 16, 2019, 12:05pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/19 "2019-09-16T12:05:31Z")

</div>

now Intel Graphics (that is… suboptimal and weird) shows up in OPENGL and I’m getting 60 fps vs 120 with JAVA2D.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [September 16, 2019, 12:27pm UTC](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997/20 "2019-09-16T12:27:39Z")

</div>

> [@Alex\_Pr](#):
>
> in OPENGL and I’m getting 60 fps vs 120 with JAVA2D.

That sounds about right. OpenGL should normally be limited to the vsync rate.

[Next page](https://discourse.processing.org/t/fullscreen-with-p2d-hangs-ubuntu-18-04/13997.md?page=2)
