You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/22 16:30:57 UTC
[GitHub] [arrow] cgostic commented on issue #15056: [R][R Shiny] Deployed/published Rshiny app using arrow to query an AWS-hosted dataset causes intermittent "stack imbalance", "segfault", "memory not mapped" errors.
cgostic commented on issue #15056:
URL: https://github.com/apache/arrow/issues/15056#issuecomment-1363055765
@boshek Thanks so much for the reply! I appreciate your time!
I've worked out a reprex I can share that still yields the error.
**Attached Materials:**
- data subset -- attached as a zipped .csv
- renv.lockfile -- (uploaded as renv_lock_txt.txt) has been converted to a text file for upload. You'll need to change the file format to use it.
- Error logs for RStudio Connect and shinyapps.io.
Steps to recreate:
**1. Write ozone data to a private AWS bucket**
```
library(arrow)
library(aws.s3)
# Using attached dataset
ozone <- read.csv(unz('ozone_data_2022.zip', 'ozone_data_2022.csv'))
bname <- '<your-bucket>'
db_uri <- paste0('s3://',bname)
write_dataset(ozone,
path = db_uri,
format = 'arrow',
partitioning = c('aqs_sitecode', 'sample_duration',
'parameter', 'poc'))
```
**2. Deploy app**
This app should run fine locally.
After deployment ( to shinyapps.io or RStudio Connect) I've observed the following:
```
# See attached lockfile for package versions
library(shiny)
library(dplyr)
library(ggplot2)
library(htmltools)
library(arrow)
library(aws.s3)
bname <- 'bucket'
db_uri <- paste0('s3://',bname)
ds <- arrow::open_dataset(db_uri, format = 'arrow', unify_schemas = F)
ui <- fluidPage(
fluidRow(column(3,
selectInput('sitecode',
label = 'Select Site',
choices = unique(metadata$aqs_sitecode),
selected = NULL)),
column(2,
div(style = 'padding-top:26px',
actionButton('go', 'Create Plot', width = '100%')))),
fluidRow(plotOutput('TS')),
fluidRow(textOutput('connstr'))
)
server <- function(input, output, session) {
selected_site <- reactiveValues(sitecode = NULL)
observeEvent(input$go, {
selected_site$sitecode <- input$sitecode
})
plot_data <- reactive({
req(selected_site$sitecode)
s <- as.integer(selected_site$sitecode)
ds %>%
filter(aqs_sitecode == s,
parameter == 'Ozone',
sample_duration == '1 HOUR',
poc == 1) %>%
select(date_time2, sample_measurement) %>%
collect()
})
output$TS <- renderPlot({
req(selected_site$sitecode,
is.data.frame(plot_data()))
ggplot(plot_data()) +
geom_line(aes(date_time2, sample_measurement)) +
scale_x_datetime() +
labs(x = 'DateTime', y = 'Ozone in ppb', main = selected_site$sitecode)
})
log_db <- reactivePoll(30000, session, #reactivePoll inside the server
# Check for maximum month
checkFunc = function() {
r_num <- ds %>%
filter(aqs_sitecode == 500070007,
sample_duration == '24 HOUR',
parameter == 'WD',
poc == 1) %>%
collect() %>%
nrow()
print(r_num)
return(as.character(r_num))
},
valueFunc = function() {
print('pinged')
return(" ")
}
)
output$connstr <- renderText(log_db())
}
shinyApp(ui = ui, server = server)
```
**3. In-app workflow to create error**
- Constant update of the plot every few seconds (select new sitecode, click "Create Plot") **will not yield an error.**
- Letting the app site idle for **~1 min and 30 seconds** will yield an error when the plot is updated after this wait-time, even with the reactivepoll collecting from the dataset every 30 seconds
[shinyappsio_logs.txt](https://github.com/apache/arrow/files/10288428/shinyappsio_logs.txt)
[rstudio_connect.log](https://github.com/apache/arrow/files/10288468/rstudio_connect.log)
[ozone_data_2022.zip](https://github.com/apache/arrow/files/10288323/ozone_data_2022.zip)
[renv_lock_txt.txt](https://github.com/apache/arrow/files/10288492/renv_lock_txt.txt)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org