Repository navigation
Description
Problem
With no project open, RStudio Desktop and RStudio Server can use the same user data directory. Desktop defaults to advisory file locks, while Server defaults to link-based file locks. Source database recovery checks only the new session's lock type, so Desktop can treat a running Server session as orphaned and rename its sources/session-<id> directory.
The original Server session remains alive but attempts to create a document fail with system error 2 (No such file or directory) when writing <document-id>-contents beneath its original session directory. Existing unsaved documents also move with the directory.
Reproduction
Reproduced on macOS with the local development build:
- Start a Server-mode rsession without a project, using a temporary
RSTUDIO_DATA_HOME, and create a document. - Keep it running and start a Desktop-mode rsession with a different launcher token, using the same temporary data directory.
- Observe that the original
sources/session-<server-id>directory is renamed to the Desktop session's ID while the Server process is still alive. - Invoke
new_documentin the Server session. It fails with ENOENT.
The reproduction invokes the actual RPC with .rs.invokeRpc("new_document", "r_source", "", list(tempName="Untitled")). Giving Desktop a separate RSTUDIO_DATA_HOME prevents the rename and the RPC succeeds.
Related test isolation problem
The rsession C++ scope in the Unix and Windows rstudio-tests launchers initializes a real session without first assigning temporary RStudio data/configuration directories. The R test scope already assigns these directories. Consequently, C++ session tests can interact with an IDE running as the same user. Unscoped Server sessions can also select the same active session ID, and source database initialization currently logs lock contention and continues.
Expected behavior
Source database recovery should recognize both lock types and leave live sessions alone. A session should refuse to reuse a source directory that another process owns. Both C++ and R session tests should use temporary RStudio state.
QA
Verify concurrent Server/Desktop sessions sharing a temporary user data directory in both launch orders. Both should retain their source directories and continue creating documents. Also verify that abandoned directories can still be recovered, that a second process cannot reuse an actively owned session directory, and that the C++ test launcher uses isolated state even when real RStudio data/configuration variables are inherited.
Activity
use the platform default lock type in desktop mode (#18748)
tidy up NEWS.md for 2026.10 (#18928)
kevinushey commentedon Oct 5, 2026
Fixed in 2026.10 by #18748 (Desktop now uses the platform default lock type, so both editions agree on how to read each other's locks) and #18853 (source recovery checks both lock types, refuses to reuse a directory another session owns, and the C++ and R test launchers now use isolated data/config directories). The namespace separation follow-up is tracked in #18746.