[Question] Is there anything that could block the event loop?
See original GitHub issueHi,
First of all, I’d like to say that I really like the new yarn 😃
Since I started using it I experienced one issue that might be related to the upgrade. I’m serving static files using the Hapi.js server. There is nothing fancy there, I’m requiring things like path
, zlib
, fs
(to read one file synchronously at the beginning of the file), @hapi/hapi
, @hapi/inert
.
I’m deploying to the k8s cluster and I noticed that sometimes the container is crashing a couple of times before it actually starts. After spending some time I discovered that it’s because of the health check issue. In logs there is nothing, everything looks normal. One of the potential reasons could be that the HTTP server starts immediately and then later there is something that can lock the event loop for some time causing some delays on health check response.
I was able to debug it a little bit by using node --trace-sync-io
flag. I’ve got something like this:
(node:7686) WARNING: Detected use of sync API
at lstatSync (fs.js:1031:25)
at lstatSync (.../.pnp.js:43875:24)
at findZip (.../.pnp.js:47775:30)
at makeCallPromise (.../.pnp.js:47742:26)
at openPromise (.../.pnp.js:47094:23)
at openPromise (.../.pnp.js:44509:24)
at openPromise (.../.pnp.js:44509:24)
at .../.pnp.js:44884:9
at processTicksAndRejections (internal/process/task_queues.js:75:11)
I’m getting this multiple times almost every time when the server serves a static file through the browser. I don’t know if this could cause the issue, so that is why I decided to create this ticket.
Is there something that could block the event loop on runtime?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
It was released with 2.1.1
Closing this as the answer to the question is: yes, but it shouldn’t do it as much anymore. If you’re able to provide a repro with the latest version of Yarn that shows a slowdown I can profile it and see if there is something that can be optimized.