{"action":"created","issue":{"url":"https://api.github.com/repos/paulmillr/chokidar/issues/444","repository_url":"https://api.github.com/repos/paulmillr/chokidar","labels_url":"https://api.github.com/repos/paulmillr/chokidar/issues/444/labels{/name}","comments_url":"https://api.github.com/repos/paulmillr/chokidar/issues/444/comments","events_url":"https://api.github.com/repos/paulmillr/chokidar/issues/444/events","html_url":"https://github.com/paulmillr/chokidar/issues/444","id":137810675,"number":444,"title":"awaitWriteFinish stopped working on FTP uploads","user":{"login":"jkrenge","id":625618,"avatar_url":"https://avatars.githubusercontent.com/u/625618?v=3","gravatar_id":"","url":"https://api.github.com/users/jkrenge","html_url":"https://github.com/jkrenge","followers_url":"https://api.github.com/users/jkrenge/followers","following_url":"https://api.github.com/users/jkrenge/following{/other_user}","gists_url":"https://api.github.com/users/jkrenge/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrenge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrenge/subscriptions","organizations_url":"https://api.github.com/users/jkrenge/orgs","repos_url":"https://api.github.com/users/jkrenge/repos","events_url":"https://api.github.com/users/jkrenge/events{/privacy}","received_events_url":"https://api.github.com/users/jkrenge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-02T08:50:48Z","updated_at":"2016-03-02T15:41:41Z","closed_at":null,"body":"Very strange, my watcher is running for months now, it worked all good, but suddenly there's a change in behaviour although I did not update anything.\r\n\r\nSetup:\r\n- Ubuntu 14.04.3 LTS\r\n- pure-ftpd 1.0.36-1.1\r\n- Node v4.2.6\r\n\r\n---\r\n\r\nMy watcher is initialised like so:\r\n\r\n```\r\nconst watcher = Chokidar.watch(Configs.watchPaths, {\r\n  persistent: true,\r\n  ignored: /[\\/\\\\]\\./,\r\n  followSymlinks: false,\r\n  awaitWriteFinish: {\r\n    stabilityThreshold: 5000\r\n  }\r\n});\r\n```\r\n\r\nI am watching for two events for debugging right now:\r\n\r\n```\r\nwatcher.on('raw', (event, path, details) => {\r\n  logToConsole('raw');\r\n  console.log('Raw event info:', event, path, details);\r\n});\r\n\r\nwatcher.on('add', function(path, event) {\r\n  logToConsole('add');\r\n  console.log(JSON.stringify(event));\r\n});\r\n```\r\n\r\n---\r\n\r\nNow when I **add a file via FTP**, one `add` event is fired directly after start of writing, when the size is still `0`, and then follow a lot of `change` events.\r\n\r\n```\r\n2016-03-02T08:35:44.022Z > raw\r\nRaw event info: rename file.csv { watchedPath: '/home/ftpusers/watched' }\r\n2016-03-02T08:35:44.038Z > add\r\n{\r\n  \"dev\": 51713,\r\n  \"mode\": 33188,\r\n  \"nlink\": 1,\r\n  \"uid\": 1001,\r\n  \"gid\": 1001,\r\n  \"rdev\": 0,\r\n  \"blksize\": 4096,\r\n  \"ino\": 699308,\r\n  \"size\": 0,\r\n  \"blocks\": 0,\r\n  \"atime\": \"2016-03-02T08:35:44.016Z\",\r\n  \"mtime\": \"2016-03-02T08:35:44.016Z\",\r\n  \"ctime\": \"2016-03-02T08:35:44.016Z\",\r\n  \"birthtime\": \"2016-03-02T08:35:44.016Z\"\r\n}\r\n2016-03-02T08:35:44.164Z > raw\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched' }\r\n2016-03-02T08:35:44.165Z > raw\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched/file.csv' }\r\n2016-03-02T08:35:44.201Z > raw\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched' }\r\n```\r\n\r\n... this goes on, until...\r\n\r\n```\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched' }\r\n2016-03-02T08:35:45.210Z > raw\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched/file.csv' }\r\n2016-03-02T08:35:45.212Z > raw\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched' }\r\n2016-03-02T08:35:45.212Z > raw\r\nRaw event info: change file.csv { watchedPath: '/home/ftpusers/watched/file.csv' }\r\n```\r\n\r\n---\r\n\r\nWhen moving a file directly to the watched folder, this happens:\r\n\r\n```\r\n2016-03-02T08:49:35.414Z > raw\r\nRaw event info: rename Parcel_LAB_2016_03_02_03_00.csv { watchedPath: '/home/ftpusers/soennecken' }\r\n2016-03-02T08:49:35.430Z > add\r\n{\r\n  \"dev\": 51713,\r\n  \"mode\": 33188,\r\n  \"nlink\": 1,\r\n  \"uid\": 1001,\r\n  \"gid\": 1001,\r\n  \"rdev\": 0,\r\n  \"blksize\": 4096,\r\n  \"ino\": 699231,\r\n  \"size\": 1132379,\r\n  \"blocks\": 2216,\r\n  \"atime\": \"2016-03-02T08:31:53.828Z\",\r\n  \"mtime\": \"2016-03-02T08:30:50.344Z\",\r\n  \"ctime\": \"2016-03-02T08:49:35.412Z\",\r\n  \"birthtime\": \"2016-03-02T08:49:35.412Z\"\r\n}\r\n```\r\n\r\nSo file size is okay.\r\n\r\n---\r\n\r\nAny ideas what I could do?"},"comment":{"url":"https://api.github.com/repos/paulmillr/chokidar/issues/comments/191292461","html_url":"https://github.com/paulmillr/chokidar/issues/444#issuecomment-191292461","issue_url":"https://api.github.com/repos/paulmillr/chokidar/issues/444","id":191292461,"user":{"login":"es128","id":1740641,"avatar_url":"https://avatars.githubusercontent.com/u/1740641?v=3","gravatar_id":"","url":"https://api.github.com/users/es128","html_url":"https://github.com/es128","followers_url":"https://api.github.com/users/es128/followers","following_url":"https://api.github.com/users/es128/following{/other_user}","gists_url":"https://api.github.com/users/es128/gists{/gist_id}","starred_url":"https://api.github.com/users/es128/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/es128/subscriptions","organizations_url":"https://api.github.com/users/es128/orgs","repos_url":"https://api.github.com/users/es128/repos","events_url":"https://api.github.com/users/es128/events{/privacy}","received_events_url":"https://api.github.com/users/es128/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T15:41:41Z","updated_at":"2016-03-02T15:41:41Z","body":"I have no explanation for why the behavior changed on you. Please double check the version you have installed, etc. Unfortunately, unless you can come up with a way for someone else to reliably reproduce this, there isn't anything we can look into or fix for you.\r\n\r\n> However, this does not allow for an initial scan, right?\r\n\r\nWhat do you mean? You should always be waiting for the `ready` event before you consider the watcher \"warmed up\". Or if you mean you're relying on the `add` events at instantiation, then keep a listener on `add`. You can also use the `getWatchedFiles` method."}}