Node-fs-extra: fs.move fails with EEXIST even when overwrite option is enabled

Created on 2 Jul 2017  路  8Comments  路  Source: jprichardson/node-fs-extra

It doesn't happen all the time but sometimes I'm getting the following error message when using move() with the overwrite options:

{ Error: EEXIST: file already exists, link '/tests/fuzzing/sync/.sync/214b820bf10c4744994fb9a876e433d3.md_1498950555952' -> '/tests/fuzzing/sync/214b820bf10c4744994fb9a876e433d3.md'
    at Error (native)
  errno: -17,
  code: 'EEXIST',
  syscall: 'link',
  path: '/tests/fuzzing/sync/.sync/214b820bf10c4744994fb9a876e433d3.md_1498950555952',
  dest: '/tests/fuzzing/sync/214b820bf10c4744994fb9a876e433d3.md' }

I'm calling it like this, as a promise: fs.move(oldPath, newPath, { overwrite: true }); and most of the time it works but sometime it's going to generate the EEXIST error. Any idea what could be the reason?

bug feature-move needs-confirmed wont-fix

Most helpful comment

Hi, I have the same problem with my Windows 10 VM (which is not WSL if I understand well, if not, please tell me)

All 8 comments

@laurent22 What OS is this happening on?

Is there any chance another application could be writing to newPath at the same time?

This is on Windows 10 under WSL (latest version). To be fair though I had all kind of problems with the file system under WSL including with reputably reliable software like SQLite. So I'm not sure if it's an issue that fs-extra can handle better or simply a bug in WSL that Microsoft needs to fix.

Yeah, probably a WSL issue. I'd welcome a PR if someone can figure out how to fix this (without too much trouble), but I'm personally not sure this is something the core team should spend time trying to fix.

CC @jprichardson @manidlou

Yeah, probably a WSL issue.

Think so too.

As @laurent22 said:

I had all kind of problems with the file system under WSL including with reputably reliable software like SQLite.

I am not sure this is even a bug from our end!

I'm personally not sure this is something the core team should spend time trying to fix.

Agreed.

Hi, I have the same problem with my Windows 10 VM (which is not WSL if I understand well, if not, please tell me)

@RyanZim @manidlou
I have the same floating issue on:

Distributor ID:  Debian
Description:  Debian GNU/Linux 8.10 (jessie)
Release:  8.10
Codename:  jessie

Version of fs-extra is 7.0.1

I think that this issue can occur while perform multiple move operation like this:

Promise.all([
    './foo/bar1',
    './foo/bar2',
    ....
    './foo/bar999'
].map((dest) => fs.move('./mySrc', dest, {override: true})));

Each of move operation include mkdirp itself and can fail on creation common root folder in concurrency mode.

Could be. When I had this bug, I was randomly creating/deleting many directories and files using a fuzzing program so it could indeed be some issue with the way move() handles concurrency.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ubershmekel picture ubershmekel  路  6Comments

monkindey picture monkindey  路  3Comments

matatk picture matatk  路  7Comments

RyanZim picture RyanZim  路  7Comments

CharlieStras picture CharlieStras  路  4Comments