P2D Hangs if no internet connection

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

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

1 Like

Plz report this as an issue in the Processing repo here. 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

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.

1 Like

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

void settings() {
  size(500, 500, P2D);
  pixelDensity(1);
}
void settings() {
  size(100, 100, P2D);
}
void settings() {
  size(100, 100);
}
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.

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

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:

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.