Hosts: Service Host: DNS Client uses > 50% CPU and block for min 5min the net

Created on 15 Aug 2018  Â·  5Comments  Â·  Source: StevenBlack/hosts

From a few months from now, host file under Win10 Pro 64bit 1803 17134.191 is the reason "DNS Client" (svchost.exe) to use 50-55% of CPU each time when the internet is activated. Also to block the internet for at least 5min during this process!
Obvious, it is bug of DNS Client, but this bug is not exist in early versions of host file (2017>).
So I am wonder, is it possible some host name(s) in host file to rise this bug?
Anybody to feel the same f..g problem?

Most helpful comment

Some similar issues are here:
https://github.com/ScriptTiger/Unified-Hosts-AutoUpdate/issues?utf8=%E2%9C%93&q=compressed

The problem is not directly the file size, but the line count. It has to do with how the DNS Client service parses the file. The solution is to use a compressed file format.

If you use the AutoUpdate script, it gives you a compression level option when you set it up and it can automatically update your hosts file with the chosen compression level every time Steven pushes an update:
https://github.com/ScriptTiger/Unified-Hosts-AutoUpdate

If you would prefer to do things manually, you can try either the compressed or mcompressed formats here:
https://scripttiger.github.io/alts/

If you would like to generate your own hosts file from scratch using Steven's script, Steven's readme suggests the following:

--compress, or -c: false (default) or true, Compress the hosts file ignoring non-necessary lines (empty lines and comments) and putting multiple domains in each line. Reducing the number of lines of the hosts file improves the performances under Windows (with DNS Client service enabled).

All 5 comments

Duplicate of #710 ?

in #710 they discuss the host file size. I don't think this is the real problem, because just few months ago everything works fine with almost the same file host size- the real problem is in some strings as host names or ip addresses

Some similar issues are here:
https://github.com/ScriptTiger/Unified-Hosts-AutoUpdate/issues?utf8=%E2%9C%93&q=compressed

The problem is not directly the file size, but the line count. It has to do with how the DNS Client service parses the file. The solution is to use a compressed file format.

If you use the AutoUpdate script, it gives you a compression level option when you set it up and it can automatically update your hosts file with the chosen compression level every time Steven pushes an update:
https://github.com/ScriptTiger/Unified-Hosts-AutoUpdate

If you would prefer to do things manually, you can try either the compressed or mcompressed formats here:
https://scripttiger.github.io/alts/

If you would like to generate your own hosts file from scratch using Steven's script, Steven's readme suggests the following:

--compress, or -c: false (default) or true, Compress the hosts file ignoring non-necessary lines (empty lines and comments) and putting multiple domains in each line. Reducing the number of lines of the hosts file improves the performances under Windows (with DNS Client service enabled).

@ScriptTiger Thank you so much for your perfect resolution. This is the right one- I just put "-c" in "python updateHostsFile.py … -c ..." and everything works like a charm, without delay or high CPU usage.
Thank you again for your perfect work.

@StevenBlack, I'm not sure if adding the -c switch to the updateHostsWindows.bat or just adding a bold/highlighted note to Windows users in the readme_template.md would be best, but addressing this would definitely solve most issues Windows users have. It can even cause seemingly unrelated networking issues by jamming up networking services and many people don't think to try this.

Was this page helpful?
0 / 5 - 0 ratings