Skip to content

Code execution stops at invisible debug point  #15016

Open

Description

@sanjmeh

System details

RStudio 2024.04.2+764 "Chocolate Cosmos" Release (e4392fc, 2024-06-05) for Ubuntu Jammy
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36, Quarto 1.4.555
R Version, nickname: Race for Your Life

Steps to reproduce the problem

  • Create a debug point inside a function called by another function.
  • Source this file.
  • Call the original function from console.
  • Code execution stops at the debug point inside the function called. (this is expected)
  • Now uncheck the debug point (such that no red dot is visible)
  • Source the target function file.
  • Press up arrow and execute the last line of code in console.
  • Code execution still stops at the same line (not expected).

Describe the problem in detail

Code execution breaks when a break point is added inside a called function in another source file. Rstudio has a great feature of adding or removing a break point even while stepping through code. However at times (this is not clear when) the code breaks at the point even after debug point has been removed.

Describe the behaviour you expected

As soon as a debug point is removed (by toggling debug points, through tools menu or just mouse click on red dot) the next execution of the function should not break at the point.

  • [ x] I have read the guide for submitting good bug reports.
  • [ x] I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • [ x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Jul 29, 2024
  2. ronblum commented on Jul 29, 2024

    @ronblum
    Contributor

    @sanjmeh Thank you for raising the issue! I'm unable to reproduce it, though. Can you provide a minimal reprex, with code sample with two functions? Thanks!

  3. added
    info needed
    and removed
    new
    on Jul 29, 2024
  4. sanjmeh commented on Jul 30, 2024

    @sanjmeh
    Author

    @sanjmeh Thank you for raising the issue! I'm unable to reproduce it, though. Can you provide a minimal reprex, with code sample with two functions? Thanks!

    I will need to replicate this by trial and error. Will wait for the next occurrence.

  5. ronblum commented on Jul 30, 2024

    @ronblum
    Contributor

    @sanjmeh Does this occur only with some code, or does it occur intermittently with the same code?

  6. sanjmeh commented on Jul 30, 2024

    @sanjmeh
    Author

    @sanjmeh Does this occur only with some code, or does it occur intermittently with the same code?

    I have found it to come up intermittently with all code. Perhaps one common factor is when nested calls of functions happen.

  7. shirewoman2 commented on Aug 1, 2024

    @shirewoman2

    I've found this to happen intermittently as well. I don't know how to predict it, and I can't offer reprex precisely because it's so unpredictable. I have also found that sometimes RStudio will enter debug mode at a red dot in a function in a package I'm building and sometimes it does not, and I have no idea what makes it work and then not work. The same code will stop one session and then, a different day, it will not.

  8. removed
    info needed
    on Aug 5, 2024
  9. jthomasmock commented on Aug 6, 2024

    @jthomasmock
    Contributor

    We're having trouble reproducing this one -- it would be great if we could have one (mostly) reproducible example of code even if intermittently failing.

  10. added
    info needed
    on Aug 6, 2024
  11. olivroy commented on Aug 21, 2024

    @olivroy
    Contributor

    I think I just encountered this.

    In a version control repo (package),

    1. set a break point in a function
    2. Call that function
    3. Modify the code slightly
    4. Go to the git pane
    5. Revert changes in to that line
    6. load_all()
    7. Call the function

    Or maybe when the same project is open in 2 sessions, it can happen too. I think it eventually solves itself..

  12. olivroy commented on Aug 21, 2024

    @olivroy
  13. olivroy commented on Aug 21, 2024

    @olivroy
  14. added this to the Kousa Dogwood milestone on Aug 21, 2024
  15. olivroy commented on Sep 3, 2024

    @olivroy
    Contributor

    FWIW, the other issue I was encountering has been fixed in the latest dailies (#15072), but I am still encountering this one!

  16. kevinushey commented on Sep 3, 2024

    @kevinushey
    Collaborator

    @olivroy do you have a reproducible example?

  17. olivroy commented on Sep 3, 2024

    @olivroy
    Contributor

    @kevinushey Unfortunately, I don't really have one. It seems that it is a breaking point that has been set in a previous session, I probably switched branches somewhere with that file open. Is there a specific location in .Rproj.user I should look at where breakpoints are stored? I am pretty sure that if I deleted the .Rproj.user folder, the breakpoint would go away.. Is it safe to delete that folder?

  18. jthomasmock commented on Sep 17, 2024

    @jthomasmock
    Contributor

    Yes you can temporarily moved or delete the .Rproj.user folder -- let us know if that resolves the issue.

  19. olivroy commented on Sep 20, 2024

    @olivroy
    Contributor

    It is strange. I tried deleting

    I have this in the .Rproj.user/2B6CC96E/pcs/debug-breakpoints.pper

    {
        "debugBreakpointsState": {
            "breakpoints": [
                {
                    "id": 15,
                    "path": "~/rrr-forks/gt/R/resolver.R",
                    "line_number": 300,
                    "function_steps": "5,3,2",
                    "function_name": "resolve_cols_i",
                    "state": 1,
                    "editor_state": 1,
                    "editor_line_number": 300,
                    "is_pending_debug_completion": false,
                    "needs_updated_steps": false,
                    "type": 0,
                    "is_package_breakpoint": true,
                    "package_name": "gt"
                }
            ]
        }
    }
    

    If I delete this file (or its contents or the entire .Rproj.user directory), it ends up reappearing, and I am still stuck with the same problem.

    Note that deleting the file when not in the RStudio session works.

    I always use the Clear all Breakpoints utility. It would be great if it deleted this file?

  20. olivroy commented on Oct 3, 2024

    @olivroy
    Contributor

    @kevinushey I stumbled on this again. Would it be possible to have a fix to make sure that the Clear all breakpoints called from the command palette destroys completely .Rproj.user/2B6CC96E/pcs/debug-breakpoints.pper. This way, we'd avoid having ghost breakpoints.

    The workaround to delete this file manually doesn't work well, because you have to quit the R session to be able to delete the file. If I delete it while the Rproject is open. RStudio will instantly write it back.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdebugginginfo needed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions