Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double entry for localhost in /etc/hosts leads to 100% CPU usage #4216

Closed
l-x opened this issue Jan 27, 2022 · 4 comments
Closed

Double entry for localhost in /etc/hosts leads to 100% CPU usage #4216

l-x opened this issue Jan 27, 2022 · 4 comments
Assignees
Milestone

Comments

@l-x
Copy link

l-x commented Jan 27, 2022

Issue Details

  • Version of AdGuard Home server:
    • v0.107.3
  • How did you install AdGuard Home:
    • GitHub releases
  • How did you setup DNS configuration:
    • System
  • CPU architecture:
    • amd64
  • Operating system and version:
    • Native (not Docker) Linux 4.14.167-0-vanilla Alpine SMP Thu Jan 23 10:14:19 UTC 2020 x86_64 Linux
  • /etc/hosts:
127.0.0.1	localhost.localdomain localhost
::1		localhost localhost.localdomain

Expected Behavior

dig localhost executed on the AGH host returns without an error

Actual Behavior

dig localhost executed on the AGH host instantly leads to 100% cpu usage and the verbose log spammed with several hundred [debug] hosts container: handling the request entries per second until it crashes silently a few minutes later.

Additional Information

Removing one of the two entries for localhost in /etc/hosts fixes the issue.

I can reproduce the issue only for localhost entries, not for other domains.

@l-x l-x changed the title Matching against /etc/hosts with IPv6 entry leads to infinite loop (100% cpu usage) Doule entry for localhost in /etc/hosts leads to 100% CPU usage Jan 27, 2022
@l-x l-x changed the title Doule entry for localhost in /etc/hosts leads to 100% CPU usage Double entry for localhost in /etc/hosts leads to 100% CPU usage Jan 27, 2022
@l-x
Copy link
Author

l-x commented Jan 27, 2022

Addendum:

When i change my /etc/hosts to

127.0.0.1	localhost.localdomain localhost
::1		localhost.localdomain localhost

everything is fine.

@EugeneOne1 EugeneOne1 self-assigned this Jan 27, 2022
@ainar-g ainar-g added this to the v0.107.4 milestone Jan 27, 2022
adguard pushed a commit that referenced this issue Jan 27, 2022
Merge in DNS/adguard-home from 4216-hosts-explode to master

Updates #4216.

Squashed commit of the following:

commit a6ed131
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 27 19:11:23 2022 +0300

    aghnet: imp docs

commit 25cca06
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 27 18:53:16 2022 +0300

    aghnet: simpl hosts container
@EugeneOne1
Copy link
Member

@l-x, hello and thanks for an exhaustive report! We've just pushed the latest edge build that should fix the problem. Could you please try it and confirm that our solution fixes the issue?

@l-x
Copy link
Author

l-x commented Jan 28, 2022

@EugeneOne1 With the latest edge build I am no more able to trigger the error, seems to be fixed xD

And thanks for the fast and friendly reply!

@EugeneOne1
Copy link
Member

@l-x, I suppose the issue may be closed. Feel free to reopen it if the problem reoccurs.

adguard pushed a commit that referenced this issue Jan 28, 2022
Merge in DNS/adguard-home from 4216-hosts-explode to master

Updates #4216.

Squashed commit of the following:

commit a6ed131
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 27 19:11:23 2022 +0300

    aghnet: imp docs

commit 25cca06
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 27 18:53:16 2022 +0300

    aghnet: simpl hosts container
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 4216-hosts-explode to master

Updates AdguardTeam#4216.

Squashed commit of the following:

commit a6ed131
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 27 19:11:23 2022 +0300

    aghnet: imp docs

commit 25cca06
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jan 27 18:53:16 2022 +0300

    aghnet: simpl hosts container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants