-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
DNS resolutions overflow UV pool #47
Comments
This should be solveable without dropping DNS. We need to
|
This sounds like a Node.js bug to me. It should not allow DNS to block the whole pool. |
|
Why? |
@issuehunt has funded $30.00 to this issue.
|
1st process/console: original About the 1st: We can see that the ram usage is increasing and decreasing very quickly which can be unstable due gc. By the way, if you do one simple call to check if it's online then the node process keep running +30s, so imagine that small leak repeated hundreds of time, that's why the ram is "unstable". This is running the current version About the 2nd: is consuming a lot of resources due a leak in the redundancy (which was added in v4) and also due a problem with About the 3rd: It's the more stable version that I could achieve. The "leak" related to redundancy is when you try to cancel the query and you get back the result cancelled but in background it continues doing every query with 5s of timeout each. Another problem is the default These tests were made without network connection as the original issue. const isOnline = require('is-online');
let count = 0;
for (let i = 0; i < 1; i++) {
setInterval(async () => {
let time = Date.now();
count++;
let result = await isOnline({ timeout: 5000 });
count--;
time = Date.now() - time;
console.log('result', result, 'count', count, 'time', time);
}, 50);
} |
@sindresorhus has rewarded $27.00 to @lukks. See it on IssueHunt
|
I found situation when using is-online gives negative consequences on my system.
Preconditions
What will happen
is-online uses domain name for network checking, it means DNS resolution will be done first. Since network is actually offline, DNS resolution is becoming very long operation, which will block thread of UV pool. Since we run it on regular basis (in my case I ran it every 5 seconds), your UV pool overflows after some time. By default UV pool size is 4.
After UV pool is overflown, all UV operations will be queued (like fs.* functions), which may cause significant delays of their execution. In my case after 20 minutes of operation, queue increased to 50-70 operations, which gave me almost never ending new operations (like fs.readFile or any other).
I'd suggest avoid DNS resolution here (in my project I implemented 8.8.8.8:53 connection instead) or cancel DNS resolution requests when timeout happens.
Information about UV pool can be found here
https://www.future-processing.pl/blog/on-problems-with-threads-in-node-js/
IssueHunt Summary
Backers (Total: $30.00)
Submitted pull Requests
Tips
IssueHunt has been backed by the following sponsors. Become a sponsor
The text was updated successfully, but these errors were encountered: