Troubleshooting

Container did not respond in time

If you see the following error message in your browser

Error
Status code: 500
Message: Container did not respond in time

it is very likely that your container was started, but that the Shiny app itself could not be started properly.

This almost always means an R error is triggered when docker is trying to launch the Shiny app.

Typical examples are:

  • some dependencies for your Shiny application were not installed into the Docker image and therefore could not be loaded when you run your application
  • you are using non-exported functions from a package and this triggers an error
  • any other R error that is triggered prior to the proper loading of your Shiny application

The best way to pinpoint the origin of the problem is to launch the docker container 'manually' i.e. independently of ShinyProxy and see whether or not this succeeds.

By means of example, let's assume the hello application of the openanalytics/shinyproxy-demo image does not work properly. In the default application.yml we can see that it is being run using

  apps:
  - name: 01_hello
    docker-cmd: ["R", "-e shinyproxy::run_01_hello()"]
    docker-image: openanalytics/shinyproxy-demo
    groups: [scientists, mathematicians]

In other words, the docker command (docker-cmd) used is ["R", "-e shinyproxy::run_01_hello()"].

In order to run it 'manually' (using the docker command line interface) we can do the following:

sudo docker run -p 3838:3838 openanalytics/shinyproxy-demo R -e 'shinyproxy::run_01_hello()' 

and this will generate the following output:

R version 3.2.4 Revised (2016-03-16 r70336) -- "Very Secure Dishes"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> shinyproxy::run_01_hello()
Loading required package: shiny

Listening on http://0.0.0.0:3838

No errors in this output, but we can see exactly what happens inside the R session. This trick can come handy if you have real errors that prevent your Shiny app to come online!

Failed to start container

If you see the following error message in your browser

Error
Status code: 500
Message: Failed to start container: Request error: POST http://localhost:2376/containers/d3e0f4c02d72f71b9619e5b70a60aa1000ae5498a3743255e9afeb9ae5cbb14b/start: 500

it is very likely that shinyproxy was not able to start the container.

The first thing to check is whether the docker daemon is running. On Ubuntu 14.04 this can be done using

$ sudo service docker status
docker start/running, process 21167

When the docker service is up and running, the most common cause is that the firewall rules on the machine prevent ShinyProxy to connect to the docker API. In that case, it is worthwhile to disable the firewall temporarily and to check whether ShinyProxy is then able to start a container.

Address already in use

If you see the following information when launching ShinyProxy (e.g. in the shinyproxy.log file)

Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:62)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

[...]

Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)

[...]

this will in all likelihood mean that another application (e.g. a Tomcat application server) is already running on port 8080, the default port ShinyProxy uses.

You can either stop the other application prior to launching ShinyProxy or use a custom port (e.g. 9999) for ShinyProxy by editing the port field in the application.yml file:

shiny:
  proxy:
    [...]
    port: 9999 

For more details, see the 'General' section of the Configuration page.