question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Is there anything that could block the event loop?

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
merceyzcommented, Jul 9, 2020

It was released with 2.1.1

0reactions
merceyzcommented, Jul 19, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Don't Block the Event Loop (or the Worker Pool) - Node.js
This provides two motivations for blocking neither the Event Loop nor the Worker Pool:
Read more >
Node.js, lots of ways to block your event-loop (and ... - Medium
The Event-loop is single-threaded​​ js you can block every request just because one of them had a blocking instruction. A good review of...
Read more >
Why does a while loop block the event loop? - Stack Overflow
It's fairly simple really. Internally, node.js consists of this type of loop: Get something from the event queue; Run whatever task is indicated...
Read more >
questions about event loops - wizard zines
no! you can usually block the event loop for as long as you want by running something CPU-intensive. reveal.
Read more >
Node.js Event-Loop: How even quick Node.js async functions ...
I recently stumbled upon a real event-loop blocking scenario here at Snyk. When I tried to fix the situation, I realized how little...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found