How to perform an strace of a running RStudio Pro Session

Follow

What is an strace?

Strace is an abbreviation for "system trace", and is a useful Linux tool that logs data about processes that exist on the server & how they interact with the Linux kernel.

When do I collect an strace?

If you are experiencing a problem with your session and you have an open ticket with Posit Support, the Posit Support engineer may ask you to collect an strace. Most of the time, the best way to collect an strace of an RStudio Pro session is to enable RStudio Pro Session diagnostics and strace through Posit Workbench settings, following the instructions in the Diagnosing Session Problems section. These instructions require a server restart of Posit Workbench as well as creating a new session in order to take effect. In some rare cases, it may be necessary to collect an strace of an RStudio Pro Session that is already running; for example, because the problem is only occurring in that session, or the problem only occurs after the session has been running for a long time.

How do I perform an strace?

  1. Open an SSH session into your server in one window.
  2. Open your Posit GUI in another window.
  3. In the Posit window, open an R session for the affected user and type Sys.getpid() to get the process ID of the R session. 
  4. Get the Posit GUI window ready to perform the action that is causing the initial issue.
  5. In the SSH session, run the following command, where $PID is the Process ID from the second step:
    strace -fttTy -s 250 -p $PID -o /tmp/posit-trace-$PID.log
  6. Immediately click back to the Posit window and perform the action which causes the issue.
  7. After it has been completed, click back to the SSH window and press Ctrl+C to end the trace.
  8. Carefully review the strace file for any sensitive information and remove it.
  9. Zip & Send us the /tmp/posit-trace-$PID.log file.

Comments