Skip to content
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

File Write Operations failing on Virtualbox shared filesystem #50876

Closed
ig-onoffice-de opened this issue Nov 23, 2023 · 2 comments · Fixed by libuv/libuv#4268
Closed

File Write Operations failing on Virtualbox shared filesystem #50876

ig-onoffice-de opened this issue Nov 23, 2023 · 2 comments · Fixed by libuv/libuv#4268
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding.

Comments

@ig-onoffice-de
Copy link

Version

20.10.0

Platform

Linux vagrant 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

I have the following Vagrantfile to set up my Virtual Box

Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-22.04"

  config.vm.synced_folder "./shared_folder", "/vagrant_data"

  config.vm.provision :shell, run: :always, inline: 'which node || snap install node --classic --channel=20'
end

the file shared_folder/create-file.js

const fs = require("fs");

const writeStream = fs.createWriteStream("empty-file.txt");
writeStream.end();

and the file shared_folder/create-and-write-file.js

const fs = require("fs");

const writeStream = fs.createWriteStream("file-with-content.txt");
writeStream.write("Hello world.");
writeStream.end();
  1. Start the box using vagrant up and log in to the box
  2. cd /vagrant_data
  3. run node create-file.js => file empty-file.txt is created
  4. run node create-and-write-file.js => file file-with-content.txt is created but does not have any content!
    error message is:
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: ENOTSUP: operation not supported on socket, write
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -95,
  code: 'ENOTSUP',
  syscall: 'write'
}

Node.js v20.10.0

How often does it reproduce? Is there a required condition?

It always happens with the shared filesystem

What is the expected behavior? Why is that the expected behavior?

File should have content.

What do you see instead?

This error message and an empty file

node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: ENOTSUP: operation not supported on socket, write
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -95,
  code: 'ENOTSUP',
  syscall: 'write'
}

Node.js v20.10.0

Additional information

  • Our hostsystem is Windows.
  • node version 19 works well, but node 18 does not

The main problem for us is, that neither npm install works.

@ig-onoffice-de
Copy link
Author

Actually, I just found out, that there is the same problem with read operations.
shared_folder/read-file.js

const fs = require("fs");

fs.readFile("helloWorld.txt", 'utf8', (err, data)=>{
		if (err) {
			console.error(err);
			return;
		}
		console.log(data);
	}
)

running node read-file.js outputs

[Error: ENOTSUP: operation not supported on socket, read] {
  errno: -95,
  code: 'ENOTSUP',
  syscall: 'read'
}

@santigimeno santigimeno added fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. labels Dec 28, 2023
santigimeno added a commit to santigimeno/libuv that referenced this issue Dec 28, 2023
Fallback to the threadpool if it returns `EOPNOTSUPP`.

Fixes: nodejs/node#50876
@santigimeno santigimeno added the confirmed-bug Issues with confirmed bugs. label Dec 28, 2023
@santigimeno
Copy link
Member

I can confirm the issue happens when writing to a vboxsf filesystem using io_uring. Possible fix here: libuv/libuv#4268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants