Shiny applications do not time out - increasing memory problem

Hi all,

We are developing and managing a system of about 8 shiny applications on a single server that are used by approximately 20-30 users simultaneously. The majority of users are accessing two main applications that are used mainly between 7 AM and 3 AM CEST. We are using Shiny Server Pro version 1.5.2.763 and version 1.0.3 of the “shiny” package.

As our hardware is limited to 4 CPU cores and 32 GB memory and there is currently no possibility to change this, we defined very restrictive timeout settings:

run_as shiny;

template_dir /etc/shiny-server/templates;

access_log /export/home/shiny/log/access.log dev;

server {
  listen 3838;

  simple_scheduler 100;
  app_session_timeout 1800;
  app_init_timeout 3600;
  app_idle_timeout 3600;
  log_dir /export/home/shiny/log;
  directory_index off;

  location /mainApp2/ {
    app_dir /export/home/shiny/shiny-server/mainApp2;
    exec_supervisor "nice -n -10";
    required_group app_tsurplus;
  }
  location /mainApp1/ {
    app_dir /export/home/shiny/shiny-server/mainApp1;
    exec_supervisor "nice -n -10";
    required_group app_tsurplus;
  }
  location /app1/ {
    app_dir /export/home/shiny/shiny-server/app1;
    required_group app_tsurplus;
  }
  location /app2/ {
    app_dir /export/home/shiny/shiny-server/app2;
    required_group app_tsurplus;
  }
  location /app3/ {
    app_dir /export/home/shiny/shiny-server/app3;
    required_group app_tsurplus;
  }
  location /app4/ {
    app_dir /export/home/shiny/shiny-server/app4;
    required_group app_tsurplus;
  }
  location /app5/ {
    app_dir /export/home/shiny/shiny-server/app5;
    required_group app_tsurplus;
  }
  location /app6/ {
    app_dir /export/home/shiny/shiny-server/app6;
    required_group app_tsurplus;
  }
  location /app7/ {
    app_dir /export/home/shiny/shiny-server/app7;
    required_group app_vbp;
  }
  location /app8/ {
    app_dir /export/home/shiny/shiny-server/app8;
    required_group app_tsurplus;
  }
}

However, since the last week we are facing the issue that these two main applications do not timeout although there were no user connections in the early morning (see

).

The fact that no timeout for the complete application happens leads to a steadily increasing memory usage. At least the server starts swapping and performance of our shiny applications decrease significantly.

Does anybody experience the same behavior and has some hints for us where to look or what to do to improve the situation? Is there anything we can do to force shiny applications to shut down and release the used memory completely when no user connections are active?

Many thanks in advance and kind regards
Sebastian

Hi Sebastian
Are you creating some UI controls dynamically ?
If so, I have noticed that the created controls tend to stick in memory, even if they have been cleared in the UI. This could be an issue if the controls are plots. I have written a post on this regard. But I have not found a solution yet

1 Like