# P2D Hangs if no internet connection

**URL:** <https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633>\
**Category:** Processing\
**Created:** [February 8, 2020, 5:15am UTC](https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633 "2020-02-08T05:15:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spikey8D](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Spikey8D](https://discourse.processing.org/u/Spikey8D)\
**Post date:** [February 8, 2020, 5:15am UTC](https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633/1 "2020-02-08T05:15:11Z")

</div>

Hi, I have encountered an odd error which I narrowed down with the following minimal repro:

```java
void settings() {
  size(500, 500, P2D);
  pixelDensity(1);
}

```

This sketch works fine if the computer is connected to a network with internet connection, or if the wifi is turned off, however it does not work if connected to a network without internet connection. It hangs on start. Adding `println` statements show that it does complete the settings function, but nothing after that. The problem doesn’t manifest if JAVA2D or FX2D are used, however they provide a signifigantly worse framerate for my current application. Any help would be appreciated!

Processing 3.5.4  
MacOS 10.15.1  
MacBook Pro 15" 2012, 2880x1800, NVIDIA GeForce 650m, OpenGL version 4.1 NVIDIA-14.0.31

Seems to work fine on Windows

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [February 9, 2020, 4:44pm UTC](https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633/2 "2020-02-09T16:44:59Z")

</div>

Plz report this as an issue in the Processing repo [here](https://github.com/processing/processing/issues). Don’t forget to add if you see this issue when you add `setup()` function to the code above. I would like to say that you will never run a sketch with only those lines. If the issue persist with a normal sample code from the Processing provided samples, then the issue should be addressed.

Kf

---

<div class="post-metadata">

**Author:** ![Spikey8D](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Spikey8D](https://discourse.processing.org/u/Spikey8D)\
**Post date:** [February 10, 2020, 2:38am UTC](https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633/3 "2020-02-10T02:38:32Z")

</div>

Hi, thanks for replying. This was a minimal repro, but it was occurring with my sketches that had full setup and display functions. I have logged an issue on the repo.

> <https://github.com/processing/processing/issues/5991>
>
> Description
> 
> Hi, I have encountered an odd error which I narrowed down with the following minimal repro:
> void settings() {
> size(500, 500, P2D);
> ...

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [February 12, 2020, 12:52am UTC](https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633/4 "2020-02-12T00:52:03Z")

</div>

To be clear, what happens is you are connected to your network with no internet and run these sketches:

```auto
void settings() {
  size(500, 500, P2D);
  pixelDensity(1);
}

```

```auto
void settings() {
  size(100, 100, P2D);
}

```

```auto
void settings() {
  size(100, 100);
}

```

```auto
void settings() {
}

```

Do some of them work and some not? Or do they all fail? If PDE cannot communicate with the sketch (e.g. through a misconfigured or blocked local network) then _I believe_ that **all** sketches should fail.

---

<div class="post-metadata">

**Author:** ![Spikey8D](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Spikey8D](https://discourse.processing.org/u/Spikey8D)\
**Post date:** [February 13, 2020, 11:47am UTC](https://discourse.processing.org/t/p2d-hangs-if-no-internet-connection/17633/5 "2020-02-13T11:47:14Z")

</div>

Ok, I tried out the snippets above, multiple test runs to verify, on a wifi wireless access point with no internet, here are the results.

1. Does not work.
2. Does not work.
3. Works fine.
4. Works fine.

For number 1 and 2. I observed what happens when the sketch is started. First a process titled `Java` is spawned, I assume to compile the sketch. Then another process is spawned with the name of the sketch as the process title. At this point it hangs. After about 20 seconds the sketch process becomes unresponsive in the macOS Activity Monitor. I sampled the sketch process in-case that would be useful: [https://gist.github.com/CallumHoward/2488d921f0ac018f915597f3ecf98b5d](https://gist.github.com/CallumHoward/2488d921f0ac018f915597f3ecf98b5d)

I also determined that if I open the Processing IDE while connected to internet and then switch to the access point network with no internet, all sketches will work for a short period. Perhaps this is a delay in network switching, even though it appears as though it has fully connected to the second network, and using ping on an external address confirms the internet is disconnected.

For the sketches that work, it prints the following to console:

```auto
2020-02-13 22:03:27.491 java[6407:42384] WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future. Called from (
        0 AppKit 0x00007fff37f416ef -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 371
        1 AppKit 0x00007fff37f3ebc1 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
        2 AppKit 0x00007fff37f3e633 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
        3 libnativewindow_macosx.jnilib 0x0000000125ca53fe Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398
        4 ??? 0x000000010ee7ba88 0x0 + 4545034888
)

```

This seems to be normal operating behaviour for working sketches since about macOS 10.14 iirc. When any of the sketches hang, no output is seen in the console.

For a sketch that is hung/unresponsive, disconnecting the network and connecting to an internet enabled network will cause it to unfreeze and proceed as normal.
