rstudio / rstudio/rstudio

File monitoring fails on filesystems that don't support ReadDirectoryChangesW (e.g. VirtualBox shared folders)

Open
#17,410 0 comments 0 reactions 0 assignees View on GitHub
bug projects windows
Dominant language
Java
Stars
5.1k
Forks
1.2k
PR merge metrics
PR metrics pending

Description

## Description

On Windows, when a project lives on a filesystem that doesn't support `ReadDirectoryChangesW` (e.g. VirtualBox shared folders using vboxsf), file monitoring fails immediately with:

```
Warning message:
File monitoring failed for project at "X:/path/to/project"
Error 1 (Incorrect function)
Features disabled: R source file indexing, Connect, Diagnostics
```

`ERROR_INVALID_FUNCTION` (1) is returned because the filesystem driver doesn't implement the ioctl that `ReadDirectoryChangesW` relies on. This is distinct from transient errors like `ERROR_NOTIFY_ENUM_DIR` — no amount of retrying will help.

Originally reported as part of #16067 (the Windows portion of that report).

## Possible approach

Fall back to polling-based monitoring when the native API reports an unsupported-filesystem error. The infrastructure for this mostly exists already: `scanFiles` + tree diffing is used for inotify overflow recovery on Linux. A periodic poll using the same mechanism could serve as a fallback when `ReadDirectoryChangesW` fails with `ERROR_INVALID_FUNCTION`.

This is the standard approach in other file watching libraries (chokidar, @parcel/watcher, efsw all fall back to stat polling on unsupported filesystems).

## Affected filesystems

- VirtualBox shared folders (vboxsf)
- Potentially other FUSE/virtual filesystem drivers that don't support change notifications

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.