Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

RStudio Viewer shows blank plots. The browser can show them though

For some reason my RStudio (v1.0.136) stopped showing plotly (v4.5.6) graphs in the Viewer.
When I right-click and Inspect element I can see the following error:

Failed to load resource: A server with the specified hostname could not be found.  

Opening that link in Chrome shows the plot, so the file is there.

When I run these commands in RStudio:

viewer <- getOption("viewer")

I get the same error. But, if I replace localhost with

viewer <- getOption("viewer")

The plot shows as expected in the Viewer window.

I have restored my /etc/hosts file (content, ownership and permissions). This did not result in any other behaviour.
I have checked the output of lsof | grep localhost:

RStudio   57564 user   12u    IPv4 0x746dc97144b1de71        0t0      TCP localhost:53434->localhost:27978 (ESTABLISHED)
RStudio   57564 user   13u    IPv4 0x746dc97144b1de71        0t0      TCP localhost:53434->localhost:27978 (ESTABLISHED)
rsession  57575 user    5u    IPv4 0x746dc97144868c81        0t0      TCP localhost:27978 (LISTEN)
rsession  57575 user    6u    IPv4 0x746dc9714568c769        0t0      TCP localhost:27978->localhost:53434 (ESTABLISHED)
rsession  57575 user   19u    IPv4 0x746dc97145a1c061        0t0      TCP localhost:14985 (LISTEN)

And to me it seems that the rsession is listening to the correct port on localhost.

I have also turned off the Mac OS firewall, this did not have any effect.

I have turned off Little Snitch (a firewall for outgoing connection) as well, this did not have any effect.

Update 2017-02-15:

I have found that this behaviour is dependent on the network I am connected to.

  • Work Ethernet - all OK
  • Home wifi - Issue as described above
  • Android wifi hotspot - all OK
  • Wifi adapter switched off - new error in the Inspect element window: Failed to load resource: The Internet connection appears to be offline``

What network setting can affect plotly’s interaction with RStudio’s Viewer?

Hey @b_a,

Perhaps this discussion will be of interest

Thanks @bcd,

However, that seems to be another issue not related to localhost/ but to the use of ArrayBuffer.
Any other suggestions are still welcome.

I find that it depends on my network configuration (see update). Anyone know how this might be possible?