shiny icon indicating copy to clipboard operation
shiny copied to clipboard

Compatibility issue with sqldf package

Open prubin73 opened this issue 1 year ago • 1 comments

Loading the sqldf package in a Shiny app causes the app not to exit gracefully. This occurs even if the sqldf() function itself does not appear in the app, and even if the app (run from a terminal) is never accessed from a browser.

System details

Browser Version:

Output of sessionInfo():

R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 21.2

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: America/New_York
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] digest_0.6.33     shinythemes_1.2.0 later_1.3.1       R6_2.5.1          httpuv_1.6.11    
 [6] fastmap_1.1.1     magrittr_2.0.3    shiny_1.7.5       htmltools_0.5.6   lifecycle_1.0.3  
[11] promises_1.2.1    cli_3.6.1         xtable_1.8-4      compiler_4.3.1    rstudioapi_0.15.0
[16] tools_4.3.1       ellipsis_0.3.2    mime_0.12         Rcpp_1.0.11       rlang_1.1.1      

Example application or steps to reproduce the problem

library(shiny)
library(sqldf)

ui <- fluidPage(
    titlePanel("Bug Demo")
)

server <- function(input, output) {
}

shinyApp(ui = ui, server = server)

Describe the problem in detail

When running the app from a terminal, the first time ctrl-C is keyed in the app fails to terminate. When running it from RStudio, the first time the "Stop" button is clicked the app fails to terminate. The second application of ctrl-C or "Stop" succeeds in terminating both the app and the R session (which is fine when running from the terminal but annoying when running from RStudio).

prubin73 avatar Aug 26 '23 18:08 prubin73

I can reproduce this, although for me, pressing Ctrl+C twice in the R console is enough to stop the app and doesn't terminate the R session (using RStudio 2023.06.1 Build 524). I also can see that this behavior confuses the "Stop" button and if pressed twice RStudio will prompt the user to terminate the R session. I'd recommend stopping the app from the console or using background jobs to run the Shiny app.

Possibly related or important, loading sqldf also loads the following packages by default:

Loading required package: gsubfn
Loading required package: proto
Loading required package: RSQLite

Of these, only RSQLite involves an interrupt handler, but it seems unlikely that it would be active simply by attaching the package. Also, calling only loadNamespace("RSQLite") and library(RSQLite) doesn't fix this.

gadenbuie avatar Aug 28 '23 13:08 gadenbuie