Loading the sqldf package (0.4-11) in a shiny (1.7.5) app prevents the app from exiting gracefully, at least when I run the app from RStudio (2023.06.1). Here's a minimal working example.
library(shiny)
library(sqldf)
ui <- fluidPage(
titlePanel("Bug Demo")
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
When I run the app from RStudio, the app opens and functions correctly. (There's no functionality in the demo, but I encountered this in a more complicated app that worked correctly.) When I close the browser window and then click the "Stop" button in the RStudio console, nothing happens (the "Stop" button remains in place, the console is tied up running the app, etc.). Eventually I get the message that R is not responding and that I need to terminate R (which works but is a bit draconian).
Is this a known issue? Is sqldf incompatible with Shiny?
It seems that there might be an issue with the compatibility between the sqldf library and shinny. When running a shiny app that includes the sqldf package, the app fails to exit gracefully when closed from RStudio, leading to unresponsiveness. While the example provided doesn't show this behavior, it's recommended to investigate further or consider alternative approaches for your app's functionality
The example I provided does exhibit the problem on my system (Linux Mint) when run from RStudio. I think it is interesting that merely loading the package, without actually calling the sqldf() function, results in the app hanging. I would file a bug report, but I'm not sure whether to classify it as a shiny bug or an RStudio bug.
I did switch away from sqldf in my Shiny app, not by choice but out of necessity.
OK, I confirmed that the same problem occurs outside RStudio. I ran the above minimal example from a terminal (on Linux Mint) while monitoring the process from a terminal. After terminating the run with ctrl-C in the first terminal, nothing happened. The second terminal continued to show the process being alive for a minute or so afterward, until I typed ctrl-C a second time in the first terminal, which succeeded in killing the process.