Shiny: "Application failed to start (exited with code 137)"

Hi there. I recently built an app that uses MLB data to build different plots. I am able to successfully deploy the app but when I try to run it through shinyapps.io, the app terminates and I get the "Application failed to start (exited with code 137)" error message. Please help!!!

This is my code for the app:

library(RSQLite)
library(DBI)
library(shiny)
library(tidyverse)
library(GeomMLBStadiums)
library(shinydashboard)
library(DT)
library(ggiraph)
library(mgcv)
library(CalledStrike)
library(ggpubr)
library(rsconnect)

SCData19 <- read.csv("data/SCData19.csv",stringsAsFactors = F)

SCData19 <-SCData19 %>%
    filter(pitches_seen >= 600)%>%
    filter(pitches_thrown >= 800)

# Define UI for application that draws a histogram
ui <- dashboardPage(skin = "blue",
                    
                    # Application title
                    dashboardHeader(title = "2019 Statcast Review"),
                    
                    # Setup Sidebar Tabs 
                    dashboardSidebar(
                        sidebarMenu(
                            menuItem("Value Inputs", tabName = "inputs_tab"),
                            menuItem("Tables", tabName = "table_tab"),
                            menuItem("Whiff Heat Map", tabName = "whiff_tab"),
                            menuItem("wOBA Heat Map", tabName = "woba_tab"),
                            menuItem("xwOBA Heat Map", tabName = "xwoba_tab"),
                            menuItem("xHit Heat Map", tabName = "xhit_tab"),
                            menuItem("Exit Velocity Heat Map", tabName = "ev_tab"),
                            menuItem("Swing Prob Heat Map", tabName = "sp_tab")
                        )
                    ),
                    
                    # Setup User Interface Dashboard
                    dashboardBody(tabItems(
                        tabItem(tabName = "inputs_tab",
                                box(title = "Hitter Input",width = 6,
                                    selectizeInput("bat_team","Select Team",choices = unique(SCData19$bat_team)),
                                    br(),
                                    selectizeInput("batter_name","Select Batter", choices = unique(SCData19$batter_name)),
                                    br(),
                                    selectizeInput("bat_pitch_class","Select Pitch Class", choices = unique(SCData19$pitch_class))
                                ),
                                box(title = "Pitcher Input", width = 6,
                                    selectizeInput("pitch_team","Select Team",choices = unique(SCData19$pitch_team)),
                                    br(),
                                    selectizeInput("pitcher_name","Select Pitcher",choices = unique(SCData19$pitcher_name)),
                                    br(),
                                    selectizeInput("pitch_pitch_class","Select Pitch Class", choices = unique(SCData19$pitch_class))
                                )
                        ),
                        tabItem(tabName = "table_tab",
                                box(title = "Hitter Table",width = 12,height = 360,
                                    div(style = 'overflow-x:scroll;height:500px;',DT::dataTableOutput("hitter_table"))),
                                box(title = "Pitcher Table",width = 12,height = 360,
                                    div(style = 'overflow-x:scroll;height:500px;',DT::dataTableOutput("pitcher_table")))
                        ),
                        tabItem(tabName = "whiff_tab",       
                                box(title = "Hitter Swing/Miss Plot",width = 6,plotOutput("hitter_swingmiss_plot")),
                                box(title = "Pitcher Swing/Miss Plot",width = 6,plotOutput("pitcher_swingmiss_plot"))
                        ),
                        tabItem(tabName = "woba_tab",       
                                box(title = "Hitter wOBA Plot",width = 6,plotOutput("hitter_woba_plot")),
                                box(title = "Pitcher wOBA Plot",width = 6,plotOutput("pitcher_woba_plot"))
                        ),
                        tabItem(tabName = "xwoba_tab",       
                                box(title = "Hitter xwOBA Plot",width = 6,plotOutput("hitter_xwoba_plot")),
                                box(title = "Pitcher xwOBA Plot",width = 6,plotOutput("pitcher_xwoba_plot"))
                        ),
                        tabItem(tabName = "xhit_tab",       
                                box(title = "Hitter xHit Plot",width = 6,plotOutput("hitter_xhit_plot")),
                                box(title = "Pitcher xHit Plot",width = 6,plotOutput("pitcher_xhit_plot"))
                        ),
                        tabItem(tabName = "ev_tab",       
                                box(title = "Hitter Exit Velocity",width = 6,plotOutput("hitter_ev_plot")),
                                box(title = "Pitcher Exit Velocity",width = 6,plotOutput("pitcher_ev_plot"))
                        ),
                        tabItem(tabName = "sp_tab",       
                                box(title = "Hitter Swing Probability",width = 6,plotOutput("hitter_sp_plot")),
                                box(title = "Pitcher Swing Probability",width = 6,plotOutput("pitcher_sp_plot"))
                        )
                    )
                    )
)

# Define server logic required to draw a histogram
server <- function(input, output, session) {
    
    swings = c("foul", "foul_tip", "hit_into_play", "hit_into_play_score",
               "hit_into_play_no_out", "swinging_strike", "swinging_strike_blocked")
    
    whiffs = c("swinging_strike", "swinging_strike_blocked")
    
    # Hitter Sorting and Plots
    SCData19hitter_reactive <- reactive({
        SCData19 %>% 
            dplyr::filter(batter_name == input$batter_name,
                          pitch_class == input$bat_pitch_class) %>% 
            mlbam_xy_transformation()
    })
    
    SCData19hitter_reactive_table <- reactive({
        SCData19 %>% 
            dplyr::filter(batter_name == input$batter_name) %>% 
            mlbam_xy_transformation()%>%
            dplyr::mutate(swing = ifelse(description %in% swings,1,0),
                          whiff = ifelse(description %in% whiffs,1,0),
                          called_strike = ifelse(description == "called_strike",1,0)) %>%
            dplyr::group_by(batter_name,pitch_class)%>%
            dplyr::summarise(pitches = n(),
                             'Average Exit Velocity' = round(mean(launch_speed,na.rm = T),3),
                             'Average Launch Angle' = round(mean(launch_angle,na.rm = T),3),
                             'Average Hit Distance' = round(mean(hit_distance_sc,na.rm = T),3),
                             swings = sum(swing),
                             whiffs = sum(whiff),
                             called_strikes = sum(called_strike)) %>%
            dplyr::mutate(whiff_pct = round(whiffs/swings,3),
                          whiff_pct = whiff_pct*100,
                          csw = round((whiffs+called_strikes)/pitches,3),
                          csw = csw*100)%>%
            dplyr::filter(pitches >= 30) %>%
            dplyr::select(batter_name, pitch_class,pitches,'Average Exit Velocity','Average Launch Angle','Average Hit Distance',whiff_pct)
    })
    bat_teams <- reactive({
        team <- subset(SCData19, bat_team %in% input$bat_team)
        team <- dplyr::select(team,"batter_name")
    })
    observe({
        updateSelectizeInput(session,"batter_name",choices = bat_teams(),selected = NULL)
    })
    output$hitter_table <- DT::renderDataTable({
        SCData19hitter_reactive_table()
    })
    output$hitter_swingmiss_plot  <- renderPlot({ 
        miss_swing_plot(SCData19hitter_reactive())
    })
    output$hitter_woba_plot  <- renderPlot({ 
        woba_plot(SCData19hitter_reactive())
    })
    output$hitter_xwoba_plot  <- renderPlot({ 
        ewoba_plot(SCData19hitter_reactive())
    })
    output$hitter_xhit_plot  <- renderPlot({ 
        ehit_plot(SCData19hitter_reactive())
    })
    output$hitter_ev_plot  <- renderPlot({ 
        ls_plot(SCData19hitter_reactive())
    })
    output$hitter_sp_plot  <- renderPlot({ 
        swing_plot(SCData19hitter_reactive())
    })
    ###########################
    # Pitcher Sorting and Plots
    SCData19pitcher_reactive <- reactive({
        SCData19 %>% 
            dplyr::filter(pitcher_name == input$pitcher_name,
                          pitch_class == input$pitch_pitch_class) %>% 
            mlbam_xy_transformation()
    })
    SCData19pitcher_reactive_table <- reactive({
        SCData19 %>% 
            dplyr::filter(pitcher_name == input$pitcher_name) %>% 
            mlbam_xy_transformation() %>%
            dplyr::mutate(swing = ifelse(description %in% swings,1,0),
                          whiff = ifelse(description %in% whiffs,1,0),
                          called_strike = ifelse(description == "called_strike",1,0)) %>%
            dplyr::group_by(pitcher_name,pitch_class)%>%
            dplyr::summarise(pitches = n(),
                             'Average Release Velocity' = round(mean(release_speed,na.rm = T),3),
                             'Average Spin Rate' = round(mean(release_spin_rate, na.rm = T),3),
                             'Average Spin Axis' = round(mean(release_spin_direction,na.rm = T),3),
                             'Average pfx_x (in feet)' = round(mean(pfx_x,na.rm = T),3),
                             'Average pfx_z (in feet)' = round(mean(pfx_z,na.rm = T),3),
                             'Average Exit Velocity Against' = round(mean(launch_speed,na.rm = T),3),
                             'Average Launch Angle Against' = round(mean(launch_angle,na.rm = T),3),
                             'Average Hit Distance Against' = round(mean(hit_distance_sc,na.rm = T),3),
                             swings = sum(swing),
                             whiffs = sum(whiff),
                             called_strikes = sum(called_strike)) %>%
            dplyr::mutate(whiff_pct = round(whiffs/swings,3),
                          whiff_pct = whiff_pct*100,
                          csw = round((whiffs+called_strikes)/pitches,3),
                          csw = csw*100)%>%
            dplyr::filter(pitches >= 30) %>%
            dplyr::select(pitcher_name,pitch_class,pitches,'Average Release Velocity','Average Spin Rate','Average Spin Axis',
                          'Average pfx_x (in feet)','Average pfx_z (in feet)',whiff_pct)
    })
    pitch_teams <- reactive({
        pitch_team <- subset(SCData19, pitch_team %in% input$pitch_team)
        pitch_team <- dplyr::select(pitch_team,"pitcher_name")
    })
    observe({
        updateSelectizeInput(session,"pitcher_name",choices = pitch_teams(),selected = NULL)
    })
    output$pitcher_table <- DT::renderDataTable({
        SCData19pitcher_reactive_table()
    })
    output$pitcher_swingmiss_plot  <- renderPlot({ 
        miss_swing_plot(SCData19pitcher_reactive())
    })
    output$pitcher_woba_plot  <- renderPlot({ 
        woba_plot(SCData19pitcher_reactive())
    })
    output$pitcher_xwoba_plot  <- renderPlot({ 
        ewoba_plot(SCData19pitcher_reactive())
    })
    output$pitcher_xhit_plot  <- renderPlot({ 
        ehit_plot(SCData19pitcher_reactive())
    })
    output$pitcher_ev_plot  <- renderPlot({ 
        ls_plot(SCData19pitcher_reactive())
    })
    output$pitcher_sp_plot  <- renderPlot({ 
        swing_plot(SCData19pitcher_reactive())
    })
}

# Run the application 
shinyApp(ui = ui, server = server)

Any help would be greatly appreciated!

Hi, welcome!

We don't have enough information to help you out, Could you check what your app's logs say?

yeah this is what it shows!

2020-12-28T18:58:25.791078+00:00 shinyapps[3432982]: rmarkdown version: 2.3
2020-12-28T18:58:25.791097+00:00 shinyapps[3432982]: knitr version: 1.30
2020-12-28T18:58:25.791107+00:00 shinyapps[3432982]: jsonlite version: 1.7.2
2020-12-28T18:58:25.791116+00:00 shinyapps[3432982]: RJSONIO version: (none)
2020-12-28T18:58:25.791121+00:00 shinyapps[3432982]: htmltools version: 0.5.0
2020-12-28T18:58:25.791335+00:00 shinyapps[3432982]: Using pandoc: /opt/connect/ext/pandoc/2.9
2020-12-28T18:58:25.981471+00:00 shinyapps[3432982]: 
2020-12-28T18:58:25.978289+00:00 shinyapps[3432982]: Using jsonlite for JSON processing
2020-12-28T18:58:25.981473+00:00 shinyapps[3432982]: Starting R with process ID: '25'
2020-12-28T18:58:27.180963+00:00 shinyapps[3432982]: ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
2020-12-28T18:58:27.186499+00:00 shinyapps[3432982]: ✔ tibble  3.0.4     ✔ dplyr   1.0.2
2020-12-28T18:58:27.186497+00:00 shinyapps[3432982]: ✔ ggplot2 3.3.2     ✔ purrr   0.3.4
2020-12-28T18:58:27.275007+00:00 shinyapps[3432982]: ✖ dplyr::filter() masks stats::filter()
2020-12-28T18:58:27.275005+00:00 shinyapps[3432982]: ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
2020-12-28T18:58:27.186499+00:00 shinyapps[3432982]: ✔ tidyr   1.1.2     ✔ stringr 1.4.0
2020-12-28T18:58:27.275008+00:00 shinyapps[3432982]: ✖ dplyr::lag()    masks stats::lag()
2020-12-28T18:58:27.186500+00:00 shinyapps[3432982]: ✔ readr   1.4.0     ✔ forcats 0.5.0
2020-12-28T18:58:27.292755+00:00 shinyapps[3432982]: Attaching package: ‘shinydashboard’
2020-12-28T18:58:27.292752+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.293407+00:00 shinyapps[3432982]:     box
2020-12-28T18:58:27.293407+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.292755+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.293406+00:00 shinyapps[3432982]: The following object is masked from ‘package:graphics’:
2020-12-28T18:58:27.293406+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.344851+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.344853+00:00 shinyapps[3432982]: Attaching package: ‘DT’
2020-12-28T18:58:27.344854+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.345160+00:00 shinyapps[3432982]: The following objects are masked from ‘package:shiny’:
2020-12-28T18:58:27.345161+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.345162+00:00 shinyapps[3432982]:     dataTableOutput, renderDataTable
2020-12-28T18:58:27.345162+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.411736+00:00 shinyapps[3432982]: Loading required package: nlme
2020-12-28T18:58:27.529895+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.529898+00:00 shinyapps[3432982]: Attaching package: ‘nlme’
2020-12-28T18:58:27.529899+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.530169+00:00 shinyapps[3432982]: 
2020-12-28T18:58:27.530168+00:00 shinyapps[3432982]: The following object is masked from ‘package:dplyr’:
2020-12-28T18:58:27.530169+00:00 shinyapps[3432982]:     collapse
2020-12-28T18:58:27.530170+00:00 shinyapps[3432982]: 
2020-12-28T18:58:28.319687+00:00 shinyapps[3432982]: This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
2020-12-28T18:58:28.662410+00:00 shinyapps[3432982]: Registered S3 method overwritten by 'quantmod':
2020-12-28T18:58:28.662412+00:00 shinyapps[3432982]:   method            from
2020-12-28T18:58:28.662413+00:00 shinyapps[3432982]:   as.zoo.data.frame zoo 
2020-12-28T18:58:29.457805+00:00 shinyapps[3432982]: 
2020-12-28T18:58:29.457807+00:00 shinyapps[3432982]: Attaching package: ‘rsconnect’
2020-12-28T18:58:29.457808+00:00 shinyapps[3432982]: 
2020-12-28T18:58:29.458078+00:00 shinyapps[3432982]: The following object is masked from ‘package:shiny’:
2020-12-28T18:58:29.458079+00:00 shinyapps[3432982]:     serverInfo
2020-12-28T18:58:29.458078+00:00 shinyapps[3432982]: 
2020-12-28T18:58:29.458079+00:00 shinyapps[3432982]: 
2020-12-28T18:58:48.356692+00:00 shinyapps[system]: Out of memory!

You are running out memory, if you are on a paid account, increase the memory for your app

so there is nothing wrong with my app, rather I just need to buy an account to get more memory?

I can't be sure of that because you are not providing a reproducible example (we don't have your data to test the app), I'm simply remarking what the logs say.

is there a way to get you the data? id like to see if you get the same problem

Please have a look at this resources, to see how to create a proper reproducible example for a shiny app, so anyone can take a look at your problem.