Skip to content

Commit f0467d7

Browse files
authored
Document Linux watcher exhaustion error. (#2243)
1 parent 2d9e787 commit f0467d7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

pkgs/watcher/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
as files, matching the behavior of the Linux and MacOS watchers.
2727
- Bug fix: with `PollingDirectoryWatcher`, fix spurious modify event emitted
2828
because of a file delete during polling.
29+
- Document behavior on Linux if the system watcher limit is hit.
2930

3031
## 1.1.4
3132

pkgs/watcher/lib/src/directory_watcher.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import 'directory_watcher/windows.dart';
2020
/// the message "Directory watcher closed unexpectedly" on the event stream. The
2121
/// code using the watcher needs to do additional work to account for the
2222
/// dropped events, for example by recomputing interesting files from scratch.
23+
///
24+
/// On Linux, the underlying SDK `Directory.watch` fails if the system limit on
25+
/// watchers has been reached. If this happens the SDK exception is thrown, it
26+
/// is a `FileSystemException` with message `Failed to watch path` and
27+
/// OSError `No space left on device`, `errorCode = 28`.
2328
abstract class DirectoryWatcher implements Watcher {
2429
/// The directory whose contents are being monitored.
2530
@Deprecated('Expires in 1.0.0. Use DirectoryWatcher.path instead.')

pkgs/watcher/lib/src/file_watcher.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import 'file_watcher/native.dart';
1616
///
1717
/// If the file is deleted and quickly replaced (when a new file is moved in its
1818
/// place, for example) this will emit a [ChangeType.MODIFY] event.
19+
///
20+
/// On Linux, the underlying SDK `File.watch` fails if the system limit on
21+
/// watchers has been reached. If this happens the SDK exception is thrown, it
22+
/// is a `FileSystemException` with message `Failed to watch path` and
23+
/// OSError `No space left on device`, `errorCode = 28`.
1924
abstract class FileWatcher implements Watcher {
2025
/// Creates a new [FileWatcher] monitoring [file].
2126
///

0 commit comments

Comments
 (0)