You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clicking the "Stop" button waits for queued messages #12059
I occasionally have code that sends many, many messages to the console from a package that I often use. When I press the "stop" button, it still waits for all of the queued messages to print. Sometimes, that can take minutes, and Rstudio will ask if I want to terminate R.
It would be preferable if the option were first to send remaining messages to /dev/null and go back to the prompt. Perhaps the UI for that would be if the "Stop" button were pressed twice or if the prompt to kill the R session were made an option would be to drop messages that are still coming in. (I don't know if this is reasonable or possible.)
Reprex (which will make you want to restart R):
forever<-function() {
while (TRUE) {
message("This is the message that never ends. It goes on and on my friends.")
}
}
forever()
Taking a look internally, it seems like the R session itself actually is getting interrupted, but RStudio is getting stuck processing the queue of accumulated messages. Perhaps we could clear out messages in the queue when an interrupt is handled?
Clearing out the message queue makes sense to me. If I hit the stop button, I probably already have all the information that I need. Maybe add a message indicating that some messages have been dropped, too.
With the PR in #12061, the behavior is improved, but not perfect -- it still takes some time for the R console to become responsive again, but it does eventually respond.
Tested on 2022.12.0-daily+257
Stopping does give the console back and is responsive.
However, I did see if you let the example run for a little bit, the entire IDE screen/window goes blank and the window is needs to be force closed (end process ) This happened on both Windows 11 and MacOS 12. On windows it happened much sooner, usually within one minute. Mac I saw it after about 4 minutes of running. @kevinushey do you think this is a separate issue and should be filed separately? I'm inclined to file it, close this one as it functions as intended... thoughts?
I think we can file that as a separate issue. I think we're overloading Chromium / Electron itself so much that the renderer itself is crashing, so the issue is (while related) worth considering separately.
Activity
kevinushey commentedon Sep 29, 2022
Thanks for the bug report!
Taking a look internally, it seems like the R session itself actually is getting interrupted, but RStudio is getting stuck processing the queue of accumulated messages. Perhaps we could clear out messages in the queue when an interrupt is handled?
billdenney commentedon Sep 29, 2022
Clearing out the message queue makes sense to me. If I hit the stop button, I probably already have all the information that I need. Maybe add a message indicating that some messages have been dropped, too.
kevinushey commentedon Sep 29, 2022
With the PR in #12061, the behavior is improved, but not perfect -- it still takes some time for the R console to become responsive again, but it does eventually respond.
jonvanausdeln commentedon Oct 11, 2022
Tested on 2022.12.0-daily+257
Stopping does give the console back and is responsive.
However, I did see if you let the example run for a little bit, the entire IDE screen/window goes blank and the window is needs to be force closed (end process ) This happened on both Windows 11 and MacOS 12. On windows it happened much sooner, usually within one minute. Mac I saw it after about 4 minutes of running. @kevinushey do you think this is a separate issue and should be filed separately? I'm inclined to file it, close this one as it functions as intended... thoughts?
kevinushey commentedon Oct 11, 2022
I think we can file that as a separate issue. I think we're overloading Chromium / Electron itself so much that the renderer itself is crashing, so the issue is (while related) worth considering separately.