Skip to content

Module stat cache keeps broken results in cache #26926

@ZauberNerd

Description

@ZauberNerd
  • Version: v11.11.0
  • Platform: Linux bb-laptop 5.0.4-arch1-1-ARCH deps: update openssl to 1.0.1j #1 SMP PREEMPT Sat Mar 23 21:00:33 UTC 2019 x86_64 GNU/Linux
  • Subsystem: module

Actual behavior:
requireing a non-existing file throws a MODULE_NOT_FOUND error, creating the file afterwards and trying to require again still throws.

Expected behavior:
The second call to require should resolve to the actual file content.

Try the following three lines in a REPL (Node v11.10.1 vs Node v11.11.0):

require('./non-existent.json');
require('fs').writeFileSync('./non-existent.json', '1');
require('./non-existent.json');

It seems like the bug was introduced with this commit: d94f4c23fe - I built Node.js with this commit and with its parent commit and was able to observe the above mentioned behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions