Open Sembiance opened 6 months ago
What is your file system and kernel (assuming Linux)?
Oh I see what's happening:
readFile
and writeFile
hang because of the flock.I'm not sure what a fix for this would look like.
I’m not too familiar with rust. But my questions would be:
Oh I see what's happening:
- We have a max tokio threadpool limit of 32.
would this be the cause for this issue also: https://github.com/denoland/deno/issues/22207 ?
@rracariu no, it's unrelated. Worker threads use OS threads, not Tokio threadpool.
We could use OS threads for async flock operations rather than spawn_blocking
? Or we could manually serialize the order of flock
calls, and only ever call tokio with flock
once per path?
Using OS threads directly sounds better than serializing flock
calls in tokio threadpool (it could still block with >32 files i think?)
Version: Deno 1.40.5
This code attempts to
.lock()
on a file, read/write a different file and then release the lock. It's called33
times all at once. All 33 correctly wait on.lock(true)
and 1 correctly acquires the lock. However that 1 then hangs forever on the read operationDeno.readTextFile()
(though Deno.open here also locks).If you change the counter from
33
to32
then everything works perfectly. Feels like a deno bug?Is this some sort of internal deno resource limit I'm hitting?
ulimit -x
showsunlimited
and nothing else fromulimit a
is anywhere close to 32.Run with:
deno run --allow-write --unstable-fs --allow-read lockLimitTest.js