{"action":"opened","issue":{"url":"https://api.github.com/repos/isaacs/node-glob/issues/197","labels_url":"https://api.github.com/repos/isaacs/node-glob/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/isaacs/node-glob/issues/197/comments","events_url":"https://api.github.com/repos/isaacs/node-glob/issues/197/events","html_url":"https://github.com/isaacs/node-glob/issues/197","id":79043630,"number":197,"title":"Callback never called for glob of same path after \"unusual\" filesystem error","user":{"login":"maxg","id":41432,"avatar_url":"https://avatars.githubusercontent.com/u/41432?v=3","gravatar_id":"","url":"https://api.github.com/users/maxg","html_url":"https://github.com/maxg","followers_url":"https://api.github.com/users/maxg/followers","following_url":"https://api.github.com/users/maxg/following{/other_user}","gists_url":"https://api.github.com/users/maxg/gists{/gist_id}","starred_url":"https://api.github.com/users/maxg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxg/subscriptions","organizations_url":"https://api.github.com/users/maxg/orgs","repos_url":"https://api.github.com/users/maxg/repos","events_url":"https://api.github.com/users/maxg/events{/privacy}","received_events_url":"https://api.github.com/users/maxg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-21T15:25:24Z","updated_at":"2015-05-21T15:25:24Z","closed_at":null,"body":"In this example, the second `console.log` never happens:\r\n\r\n    var fs = require('fs')\r\n    fs.readdir = function(path, cb) { cb(new Error()) }\r\n    var glob = require('glob')\r\n    glob('*', function(err, files) { console.log('1st callback', err, files) })\r\n    glob('*', function(err, files) { console.log('2nd callback', err, files) })\r\n\r\nProblem appears to be that in `strict` mode (the default), when an \"unusual\" filesystem occurs, `_readdirError` returns without calling the `inflight`-ified callback ([line 568](https://github.com/isaacs/node-glob/blob/7a0d65d7ed11871be6b5a68dc6f15e3f4b3fb93d/glob.js#L568)). On a subsequent search of the same path, `_readdir` adds its callback to the zombie `inflight` request and returns ([line 497](https://github.com/isaacs/node-glob/blob/7a0d65d7ed11871be6b5a68dc6f15e3f4b3fb93d/glob.js#L497)). The callback is never called.\r\n\r\nI don't understand the eventemitter/callback wiring well enough to propose a fix."}}