New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
short read in readEvents on Windows #72
Comments
That error would be coming from here: https://github.com/go-fsnotify/fsnotify/blob/master/windows.go#L448 Unfortunately I don't know the Windows code very well yet. It was inherited from Chris Howey's version of fsnotify, which was inherited from winfsnotify. If you manage to add enough to a code example to reproduce the issue, that would really help. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
See also howeyc/fsnotify#122 |
we were able to fix this by making the windows i/o buffer dynamically adjustable, as in tilt-dev#5 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
It's now maintained again @nicks! I looked at your patch in tilt-dev#5, but it doesn't really "dynamically" adjust the buffer size: people will have to call It would be better to increase the buffer size as needed; the windows code is a bit messy, but I'm sure this has got to be possible. Do you want to work on a patch for this? Also: I wonder if we can't just double the buffer size to 8K or 16K or something, which should at least make things a bit better. It looks like tilt uses 64K by default. |
People are running in to trouble because the 4K buffer can overflow; see: #72. This is not a "real" fix, but I think a 64K buffer is acceptable even on memory-limited machines; no one is running the Windows on an Arduino, and even with something like 128M of memory, the extra 124K is basically negligible. There is also no real performance difference between allocating a large array vs. a small array: they're both comparable. It should probably be enough for most applications. Need to look in the future to either dynamically grow the size, or allow setting it similar to what tilt does as mentioned in #72.
People are running in to trouble because the 4K buffer can overflow; see: #72. This is not a "real" fix, but I think a 64K buffer is acceptable even on memory-limited machines; no one is running the Windows on an Arduino, and even with something like 128M of memory, the extra 124K is basically negligible. There is also no real performance difference between allocating a large array vs. a small array: they're both comparable. It should probably be enough for most applications. Need to look in the future to either dynamically grow the size, or allow setting it similar to what tilt does as mentioned in #72.
People are running in to trouble because the 4K buffer can overflow; see: #72. This is not a "real" fix, but I think a 64K buffer is acceptable even on memory-limited machines; no one is running the Windows on an Arduino, and even with something like 128M of memory, the extra 124K is basically negligible. There is also no real performance difference between allocating a large array vs. a small array: they're both comparable. It should probably be enough for most applications. Need to look in the future to either dynamically grow the size, or allow setting it similar to what tilt does as mentioned in #72.
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(10*time.Duration), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(10*time.Duration), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we might want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(time.Second), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we might want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(time.Second), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we might want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(time.Second), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we might want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(time.Second), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we might want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(time.Second), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
…521) This is similar to Add(), except that you can pass options. Ideally this should just be Add(), but that's not a compatible change, so we're stuck with this until we do a v2. There are quite a few enhancements that depend on *some* way to pass options; as an example I added WithBufferSize() to control the buffer size for (see #72) for the Windows backend, because that one is fairly trivial to implement: w, err := fsnotify.NewWatcher() err = w.AddWith("/path", fsnotify.WithBufferSize(65536*4)) Some other options we might want to add: err = w.AddWith("/path", fsnotify.WithEvents(fsnotify.Open | fsnotify.Close), // Filter events fsnotify.WithPoll(time.Second), // Use poll watcher fsnotify.WithFanotify(), // Prefer fanotify on Linux fsnotify.WithFollowLinks(true), // Control symlink follow behaviour fsnotify.WithDebounce(100*time.Milliseconds), // Automatically debounce duplicate events fsnotify.WithRetry(1*time.Second, 1*time.Minute), // Retry every second if the path disappears for a minute ) These are just some ideas, nothing fixed here yet. Some of these options are likely to change once I get around to actually working on it. This uses "functional options" so we can add more later. Options are passed to Add() rather than the Watcher itself, so the behaviour can be modified for every watch, rather than being global. This way you can do things like watch /nfs-drive with a poll backend, and use the regular OS backend for ~/dir, without having to create two watchers. This upgrades fairly nicely to v2 where we rename AddWith() to Add(): err = w.Add("/path", fsnotify.WithBufferSize(65536*4), fsnotify.WithEvents(fsnotify.Open | fsnotify.Close)) Folks will just have to s/fsnotify.AddWith/fsnotify.Add/, without having to change all the option names. Plus having a consistent prefix autocompletes nicely in editors. Fixes #72
I have some
watcher.Errors: short read in readEvents()
once every couple of minutes.I'm not able to reproduce the problem if I run the smallest code possible to watch the same directory.
What should I try next to reproduce the
short read
error?go version go1.4.2 windows/386
The text was updated successfully, but these errors were encountered: