I have the Standard Plan from Shiny Apps and I'm trying to deploy a small app that works perfectly local and loads relatively fast. The app basically predicts a possible next word given a sentence input from the user.
However, I'm getting the following error: "The application failed to start: exited normally with code 137, signal 9 (SIGKILL)"
The app works by first loading 3 XLSX files:
library(readxl)
df <- list()
df$trigram_df <- read_xlsx("df$trigram_df.xlsx")
df$bigram_df <- read_xlsx("df$bigram_df.xlsx")
df$unigram_df <- read_xlsx("df$unigram_df.xlsx")
Their sizes as XLSX files are: 29.2 MB (df$trigram_df.xlsx), 15.0 MB (df$bigram_df.xlsx), and 1.23 MB (df$unigram_df.xlsx).
When loading them into R and applying object.size()
and dividing the result by "1e+6", they are using in memory 112.9 MB (df$trigram_df), 59.8 MB (df$bigram_df), and 7.8 MB (df$unigram_df).
Then, I just create the function I use to predict the next word with the help of some dplyr functions, and finally I create the "ui" and the "server" sections for my Shiny App with the help of the shinydashboard package.
According to this question: Shiny exited normally with code 137, signal 9 (SIGKILL) and this post https://community.rstudio.com/t/uploading-large-datasets-into-shinyapps-io/54386, there shouldn't be a problem since all my files are way below 1 GB. And, even if somehow they get larger sizes, I have paid the Standard Plan as I mentioned.
What am I doing wrong? How can I solve this?
Thanks.
I finally solved it. One of the solutions was indeed to get the paid plan and then increase the "Instance Size" in the "Settings" tab of the Shiny App general dashboard (or indicating it manually through the "size" argument in rsconnect::configureApp()
).
However, I also solved this issue by loading in R all CSV, XLSX files I was using, and then saving them as RDS files with saveRDS()
. Then, you can load them with readRDS()
. This will not reduce memory within R, but will substantially reduce the size of the input files (in my case by almost one-third), allowing one to be below the bundle size limit and able to deploy with the free paid plan of Shiny Apps.