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

support nodejs version 20.x (only a problem for testing with client/server in the same process) #1

Open
williamstein opened this issue Aug 25, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@williamstein
Copy link
Contributor

The following is a minimal reproducible example to show how this doesn't work with node 20 (but does with node 18 and 16).

~/websocketfs$ node
Welcome to Node.js v20.5.1.
Type ".help" for more information.
>  z = await require('.').bind(process.env.HOME,'/tmp/mnt'); null
null
> await require('fs/promises').writeFile('/tmp/mnt/a','foo'); (await require('fs/promises').readFile('/tmp/mnt/a')).toString()
> Uncaught [Error: ETIMEDOUT: connection timed out, open '/tmp/mnt/a'] {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'open',
  path: '/tmp/mnt/a'
@williamstein williamstein added the bug Something isn't working label Aug 25, 2023
@williamstein
Copy link
Contributor Author

This deadlock only happens when the client and server are running in the same process.

@williamstein
Copy link
Contributor Author

require('fs').open('/tmp/mnt2/a',(a,b)=>{console.log('FIRST', b); require('fs').open('/tmp/mnt2/a',(a,b)=>console.log("SECOND",b));})

I think the problem is entirely due to having the client and the server in the same process. If they are run in separate processes, things are fine. For any real use of websocketfs, they are in a separate process. For testing it is very convenient to have the client and server in the same process.

@williamstein
Copy link
Contributor Author

Note that node-fuse is a C module that is being directly linked, and that's very likely what leads to the locks.

I also find that using websocketfs combined with a separate websocket for something else in the same process docker container leads to a lock.

Workaround: put websocketfs in its own process.

It might be that the fix for this particular issue is to use a webworker in nodejs. I wonder if that works?

@williamstein williamstein changed the title support nodejs version 20.x support nodejs version 20.x (only a problem for testing with client/server in the same process) Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant