Skip to content

Clicking the "Stop" button waits for queued messages #12059

Closed

Description

@billdenney

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()

image

image

Activity

  1. added
    new
    on Sep 29, 2022
  2. kevinushey commented on Sep 29, 2022

    @kevinushey
    Collaborator

    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?

  3. billdenney commented on Sep 29, 2022

    @billdenney
    Author

    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.

  4. kevinushey commented on Sep 29, 2022

    @kevinushey
    Collaborator

    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.

  5. removed
    new
    on Sep 30, 2022
  6. added this to the Elsbeth Geranium milestone on Oct 4, 2022
  7. jonvanausdeln commented on Oct 11, 2022

    @jonvanausdeln

    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?

  8. kevinushey commented on Oct 11, 2022

    @kevinushey
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions