Open williamstein opened 1 year ago
This deadlock only happens when the client and server are running in the same process.
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.
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?
The following is a minimal reproducible example to show how this doesn't work with node 20 (but does with node 18 and 16).