# huge DNS query lags

## Ancestor

hi, I've recently encountered a strange problem.. while browsing with firefox sometimes refreshing or opening new pages was becoming laggy.. after some testing I discovered, that it's probably caused by some DNS problems

I use dnsmasq (version 2.45) to cache queries, and most of the time, running `time dig somewebpage` returns something like:

 *Quote:*   

> # time dig google.com
> 
> ; <<>> DiG 9.4.3-P2 <<>> google.com
> 
> ;; global options:  printcmd
> ...

 

and when query is not cached by dnsmasq:

 *Quote:*   

> # time dig google.com
> 
> ; <<>> DiG 9.4.3-P2 <<>> google.com
> 
> ;; global options:  printcmd
> ...

 

but from time to time it's something like:

 *Quote:*   

> # time dig google.com
> 
> (...)
> 
> real	0m14.027s
> ...

 

and dns query time is still low: around 0ms - 100ms

but I have to wait for at least several seconds to get the result

does anyone know what may be causing the problems?

----------

## malern

Do you still get the same problem if you bypass dnsmasq and query your ISPs DNS servers directly?

----------

## Ancestor

as far as I remember, I had the same problem with line 'nameserver 127.0.0.1' commented out in /etc/resolv.conf, but I didn't have enough time to test it thoroughly

I'll try to check it when DNS queries start making problems again

----------

## malern

 *Ancestor wrote:*   

> 
> 
>  *Quote:*   # time dig google.com
> 
> (...)
> ...

 

Are you sure the "Query Time" line reported by dig is less than 100ms in this case? That would indicate that dig is having no trouble contacting DNS server and getting a quick response. Seeing as that is pretty much all dig does, I can't think what it would be doing in the extra 14 seconds.

I would run "strace -r dig google.com" when the problem is happening, and see where it spends the most time.

----------

## Ancestor

 *malern wrote:*   

> Are you sure the "Query Time" line reported by dig is less than 100ms in this case?

 

yes, when it starts to by laggy, I can for instance dig google.com 2 times without any problem, and 3rd time it locks for several seconds.. next time it may work properly or lock once again, and so on.. but always with low query time

 *malern wrote:*   

> I would run "strace -r dig google.com" when the problem is happening, and see where it spends the most time.

 

ok, I'll try it, thanks  :Smile: 

----------

## Ancestor

so, it happened once again.. I digged url of the website I was trying to enter:

```
$ strace -r dig forum.teabot.org

     0.000000 execve("/usr/bin/dig", ["dig", "forum.teabot.org"], [/* 62 vars */]) = 0

     0.000743 brk(0)                    = 0x254d000

     0.000554 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7ac3000

     0.000103 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7ac2000

     0.000072 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)

     0.000119 open("/etc/ld.so.cache", O_RDONLY) = 3

     0.000067 fstat(3, {st_mode=S_IFREG|0644, st_size=166839, ...}) = 0

     0.000079 mmap(NULL, 166839, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3dd7a99000

     0.011335 close(3)                  = 0

     0.000146 open("/usr/lib/libcrypto.so.0.9.8", O_RDONLY) = 3

     0.000083 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\215\6\0\0\0\0\0@"..., 832) = 832

     0.000076 fstat(3, {st_mode=S_IFREG|0555, st_size=1576792, ...}) = 0

     0.000071 mmap(NULL, 3687160, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3dd7525000

     0.000063 mprotect(0x7f3dd7681000, 2093056, PROT_NONE) = 0

     0.000056 mmap(0x7f3dd7880000, 155648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15b000) = 0x7f3dd7880000

     0.000075 mmap(0x7f3dd78a6000, 13048, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3dd78a6000

     0.000069 close(3)                  = 0

     0.000081 open("/lib/libc.so.6", O_RDONLY) = 3

     0.000080 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\345\1\0\0\0\0\0@"..., 832) = 832

     0.000069 fstat(3, {st_mode=S_IFREG|0755, st_size=1330352, ...}) = 0

     0.000071 mmap(NULL, 3437208, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3dd71dd000

     0.000057 mprotect(0x7f3dd731c000, 2093056, PROT_NONE) = 0

     0.000054 mmap(0x7f3dd751b000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13e000) = 0x7f3dd751b000

     0.000070 mmap(0x7f3dd7520000, 17048, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7520000

     0.000064 close(3)                  = 0

     0.000061 open("/lib/libdl.so.2", O_RDONLY) = 3

     0.000073 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\16\0\0\0\0\0\0@"..., 832) = 832

     0.000065 fstat(3, {st_mode=S_IFREG|0755, st_size=14520, ...}) = 0

     0.000065 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7a98000

     0.000065 mmap(NULL, 2109728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f3dd6fd9000

     0.000053 mprotect(0x7f3dd6fdb000, 2097152, PROT_NONE) = 0

     0.000054 mmap(0x7f3dd71db000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f3dd71db000

     0.000075 close(3)                  = 0

     0.000097 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7a97000

     0.000067 arch_prctl(ARCH_SET_FS, 0x7f3dd7a976f0) = 0

     0.000078 mprotect(0x7f3dd71db000, 4096, PROT_READ) = 0

     0.000183 mprotect(0x7f3dd751b000, 16384, PROT_READ) = 0

     0.000654 mprotect(0x7f3dd7880000, 57344, PROT_READ) = 0

     0.000146 mprotect(0x73e000, 4096, PROT_READ) = 0

     0.000067 mprotect(0x7f3dd7ac4000, 4096, PROT_READ) = 0

     0.000050 munmap(0x7f3dd7a99000, 166839) = 0

     0.000172 rt_sigaction(SIGINT, {0x4ee890, ~[RTMIN RT_1], SA_RESTORER, 0x7f3dd720e1d0}, NULL, 8) = 0

     0.000123 rt_sigaction(SIGTERM, {0x4ee890, ~[RTMIN RT_1], SA_RESTORER, 0x7f3dd720e1d0}, NULL, 8) = 0

     0.000060 rt_sigaction(SIGPIPE, {0x1, ~[RTMIN RT_1], SA_RESTORER, 0x7f3dd720e1d0}, NULL, 8) = 0

     0.000058 rt_sigaction(SIGHUP, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7f3dd720e1d0}, NULL, 8) = 0

     0.000065 rt_sigprocmask(SIG_UNBLOCK, [HUP INT TERM], NULL, 8) = 0

     0.000063 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3

     0.000069 close(3)                  = 0

     0.000076 socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3

     0.000059 getsockname(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0

     0.000078 close(3)                  = 0

     0.000053 socket(PF_FILE, SOCK_STREAM, 0) = 3

     0.000050 close(3)                  = 0

     0.000131 brk(0)                    = 0x254d000

     0.000071 brk(0x256e000)            = 0x256e000

     0.000136 mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7a56000

     0.000540 epoll_create(64)          = 3

     0.000247 brk(0x258f000)            = 0x258f000

     0.000136 open("/usr/share/locale/en_US.UTF-8/libdst.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.012920 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libdst.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000129 open("/usr/share/locale/en/libdst.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000061 open("/usr/share/locale/en/LC_MESSAGES/libdst.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000084 open("/usr/share/locale/en_US.UTF-8/libisc.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000063 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libisc.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000060 open("/usr/share/locale/en/libisc.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000058 open("/usr/share/locale/en/LC_MESSAGES/libisc.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000916 open("/usr/share/locale/en_US.UTF-8/libdns.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000172 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libdns.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000081 open("/usr/share/locale/en/libdns.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000059 open("/usr/share/locale/en/LC_MESSAGES/libdns.cat", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000127 open("/home/konrad/.digrc", O_RDONLY) = -1 ENOENT (No such file or directory)

     0.000134 open("/etc/resolv.conf", O_RDONLY) = 4

     0.000083 fstat(4, {st_mode=S_IFREG|0644, st_size=459, ...}) = 0

     0.000070 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7ac1000

     0.000060 read(4, "# Generated by dhcpcd\n# /etc/reso"..., 4096) = 459

     0.000088 read(4, ""..., 4096)      = 0

     0.000052 close(4)                  = 0

     0.000050 munmap(0x7f3dd7ac1000, 4096) = 0

     0.000111 rt_sigaction(SIGHUP, {0x4ee8a0, ~[RTMIN RT_1], SA_RESTORER, 0x7f3dd720e1d0}, NULL, 8) = 0

     0.000155 getpid()                  = 1820

     0.000751 brk(0x25b5000)            = 0x25b5000

     0.000496 brk(0x25d7000)            = 0x25d7000

     0.000190 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4

     0.000076 fcntl(4, F_DUPFD, 20)     = 20

     0.000053 close(4)                  = 0

     0.000047 fcntl(20, F_GETFL)        = 0x2 (flags O_RDWR)

     0.000055 fcntl(20, F_SETFL, O_RDWR|O_NONBLOCK) = 0

     0.000054 setsockopt(20, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0

     0.000060 setsockopt(20, SOL_IP, IP_MTU_DISCOVER, [0], 4) = 0

     0.000054 getsockopt(20, SOL_SOCKET, SO_RCVBUF, [17179987968], [4]) = 0

     0.000060 bind(20, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

     0.000106 recvmsg(20, 0x7fff52d660e0, 0) = -1 EAGAIN (Resource temporarily unavailable)

     0.000074 epoll_ctl(3, EPOLL_CTL_ADD, 20, {EPOLLIN, {u32=20, u64=20}}) = 0

     0.000072 sendmsg(20, {msg_name(16)={sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, msg_iov(1)=[{"\250\245\1\0\0\1\0\0\0\0\0\0\5forum\6teabot\3org\0\0\1\0"..., 34}], msg_controllen=0, msg_flags=0}, 0) = 34

     0.000339 epoll_wait(3, {}, 64, 0)  = 0

     0.000059 epoll_wait(3, {}, 64, 999) = 0

     0.998478 epoll_wait(3, {}, 64, 1)  = 0

     0.000974 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4

     0.000035 fcntl(4, F_DUPFD, 20)     = 21

     0.000019 close(4)                  = 0

     0.000017 fcntl(21, F_GETFL)        = 0x2 (flags O_RDWR)

     0.000018 fcntl(21, F_SETFL, O_RDWR|O_NONBLOCK) = 0

     0.000018 setsockopt(21, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0

     0.000031 setsockopt(21, SOL_IP, IP_MTU_DISCOVER, [0], 4) = 0

     0.000021 getsockopt(21, SOL_SOCKET, SO_RCVBUF, [17179987968], [4]) = 0

     0.000026 bind(21, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

     0.000040 recvmsg(21, 0x7fff52d66050, 0) = -1 EAGAIN (Resource temporarily unavailable)

     0.000032 epoll_ctl(3, EPOLL_CTL_ADD, 21, {EPOLLIN, {u32=21, u64=21}}) = 0

     0.000032 sendmsg(21, {msg_name(16)={sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("217.30.129.149")}, msg_iov(1)=[{"\250\245\1\0\0\1\0\0\0\0\0\0\5forum\6teabot\3org\0\0\1\0"..., 34}], msg_controllen=0, msg_flags=0}, 0) = 34

     0.000126 epoll_wait(3, {}, 64, 0)  = 0

     0.000021 epoll_wait(3, {}, 64, 1000) = 0

     0.999617 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4

     0.000046 fcntl(4, F_DUPFD, 20)     = 22

     0.000019 close(4)                  = 0

     0.000017 fcntl(22, F_GETFL)        = 0x2 (flags O_RDWR)

     0.000018 fcntl(22, F_SETFL, O_RDWR|O_NONBLOCK) = 0

     0.000017 setsockopt(22, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0

     0.000031 setsockopt(22, SOL_IP, IP_MTU_DISCOVER, [0], 4) = 0

     0.000022 getsockopt(22, SOL_SOCKET, SO_RCVBUF, [17179987968], [4]) = 0

     0.000025 bind(22, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

     0.000039 recvmsg(22, 0x7fff52d66050, 0) = -1 EAGAIN (Resource temporarily unavailable)

     0.000032 epoll_ctl(3, EPOLL_CTL_ADD, 22, {EPOLLIN, {u32=22, u64=22}}) = 0

     0.000033 sendmsg(22, {msg_name(16)={sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("217.30.137.200")}, msg_iov(1)=[{"\250\245\1\0\0\1\0\0\0\0\0\0\5forum\6teabot\3org\0\0\1\0"..., 34}], msg_controllen=0, msg_flags=0}, 0) = 34

     0.000128 epoll_wait(3, {}, 64, 0)  = 0

     0.000022 epoll_wait(3, {}, 64, 5000) = 0

     4.999594 sendmsg(20, {msg_name(16)={sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, msg_iov(1)=[{"\250\245\1\0\0\1\0\0\0\0\0\0\5forum\6teabot\3org\0\0\1\0"..., 34}], msg_controllen=0, msg_flags=0}, 0) = 34

     0.000241 epoll_wait(3, {{EPOLLIN, {u32=20, u64=20}}}, 64, 0) = 1

     0.000036 epoll_ctl(3, EPOLL_CTL_DEL, 20, {EPOLLIN, {u32=20, u64=22165926782697492}}) = 0

     0.000030 recvmsg(20, {msg_name(16)={sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, msg_iov(1)=[{"\250\245\201\200\0\1\0\2\0\0\0\0\5forum\6teabot\3org\0\0\1\0"..., 65535}], msg_controllen=32, {cmsg_len=32, cmsg_level=SOL_SOCKET, cmsg_type=0x1d /* SCM_??? */, ...}, msg_flags=0}, 0) = 74

     0.000138 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0

     0.000038 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7ac1000

     0.000039 write(1, "\n"..., 1

)      = 1

     0.000024 write(1, "; <<>> DiG 9.4.3-P2 <<>> forum.te"..., 42; <<>> DiG 9.4.3-P2 <<>> forum.teabot.org

) = 42

     0.000025 write(1, ";; global options:  printcmd\n"..., 29;; global options:  printcmd

) = 29

     0.000073 write(1, ";; Got answer:\n"..., 15;; Got answer:

) = 15

     0.000035 write(1, ";; ->>HEADER<<- opcode: QUERY, st"..., 58;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43173

) = 58

     0.000037 write(1, ";; flags: qr rd ra; QUERY: 1, ANS"..., 69;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

) = 69

     0.000088 write(1, "\n"..., 1

)      = 1

     0.000033 write(1, ";; QUESTION SECTION:\n;forum.teabo"..., 147;; QUESTION SECTION:

;forum.teabot.org.      IN   A

;; ANSWER SECTION:

forum.teabot.org.   3597   IN   CNAME   teabot.org.

teabot.org.      2610   IN   A   83.19.62.242

) = 147

     0.000080 write(1, ";; Query time: 0 msec\n"..., 22;; Query time: 0 msec

) = 22

     0.000036 write(1, ";; SERVER: 127.0.0.1#53(127.0.0.1"..., 35;; SERVER: 127.0.0.1#53(127.0.0.1)

) = 35

     0.000044 open("/etc/localtime", O_RDONLY) = 4

     0.000045 fstat(4, {st_mode=S_IFREG|0644, st_size=2679, ...}) = 0

     0.000037 fstat(4, {st_mode=S_IFREG|0644, st_size=2679, ...}) = 0

     0.000031 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3dd7ac0000

     0.000026 read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\0\0\0\n\0\0\0\0\0"..., 4096) = 2679

     0.000047 lseek(4, -1698, SEEK_CUR) = 981

     0.000018 read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\v\0\0\0\v\0\0\0\0\0"..., 4096) = 1698

     0.000037 close(4)                  = 0

     0.000019 munmap(0x7f3dd7ac0000, 4096) = 0

     0.000056 write(1, ";; WHEN: Tue Jun 23 13:21:45 2009"..., 34;; WHEN: Tue Jun 23 13:21:45 2009

) = 34

     0.000038 write(1, ";; MSG SIZE  rcvd: 74\n"..., 22;; MSG SIZE  rcvd: 74

) = 22

     0.000030 write(1, "\n"..., 1

)      = 1

     0.000054 epoll_ctl(3, EPOLL_CTL_DEL, 20, {EPOLLIN, {u32=20, u64=1876900708372}}) = -1 ENOENT (No such file or directory)

     0.000034 epoll_ctl(3, EPOLL_CTL_DEL, 20, {EPOLLOUT, {u32=20, u64=1876900708372}}) = -1 ENOENT (No such file or directory)

     0.000022 close(20)                 = 0

     0.000047 epoll_ctl(3, EPOLL_CTL_DEL, 21, {EPOLLIN, {u32=21, u64=15540843864947425301}}) = 0

     0.000024 epoll_ctl(3, EPOLL_CTL_DEL, 21, {EPOLLOUT, {u32=21, u64=15540843864947425301}}) = -1 ENOENT (No such file or directory)

     0.000021 close(21)                 = 0

     0.000024 epoll_ctl(3, EPOLL_CTL_DEL, 22, {EPOLLIN, {u32=22, u64=15540843864947425302}}) = 0

     0.000022 epoll_ctl(3, EPOLL_CTL_DEL, 22, {EPOLLOUT, {u32=22, u64=15540843864947425302}}) = -1 ENOENT (No such file or directory)

     0.000021 close(22)                 = 0

     0.000040 kill(1820, SIGTERM)       = 0

     0.000021 --- SIGTERM (Terminated) @ 0 (0) ---

     0.000019 rt_sigreturn(0xf)         = 0

     0.000297 close(3)                  = 0

     0.000282 munmap(0x7f3dd7a56000, 266240) = 0

     0.000101 exit_group(0)             = ?

```

and here are the biggest lags listed, to make them easier to notice:

```

     (...)

     0.000339 epoll_wait(3, {}, 64, 0)  = 0

     0.000059 epoll_wait(3, {}, 64, 999) = 0

     0.998478 epoll_wait(3, {}, 64, 1)  = 0

     0.000974 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4

     (...)

     0.000021 epoll_wait(3, {}, 64, 1000) = 0

     0.999617 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4

     0.000046 fcntl(4, F_DUPFD, 20)     = 22

     (...)

     0.000128 epoll_wait(3, {}, 64, 0)  = 0

     0.000022 epoll_wait(3, {}, 64, 5000) = 0

     4.999594 sendmsg(20, {msg_name(16)={sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, msg_iov(1)=[{"\250\245\1\0\0\1\0\0\0\0\0\0\5forum\6teabot\3org\0\0\1\0"..., 34}], msg_controllen=0, msg_flags=0}, 0) = 34

     0.000241 epoll_wait(3, {{EPOLLIN, {u32=20, u64=20}}}, 64, 0) = 1

     0.000036 epoll_ctl(3, EPOLL_CTL_DEL, 20, {EPOLLIN, {u32=20, u64=22165926782697492}}) = 0

     (...)

```

do you have any ideas what the problem could be?

EDIT:

I tried it few more times and it didn't took lot of time on sendmsg(), but only on epoll_wait() and socket(), or sometimes only on epoll_wait()

it's strange

----------

## malern

Looks like dig tries sending the request to 3 different DNS servers (127.0.0.1, then 217.30.129.149, and then 217.30.137.200), but times-out before it gets a response on from any of them. Then it retries 127.0.0.1 again and suddenly gets a response.

I assume that 217.30.129.149 and 217.30.137.200 are your ISPs DNS servers? If there was a problem contacting those servers, then that would cause dnsmasq to lag whilst it retries it's own queries to them (assuming the domain your requesting isn't in its cache).

So I'd guess the problem is either with the ISP DNS servers, or your internet connection. You could try specifying some different DNS servers to use, see if that makes any difference. Try the opendns ones if you don't know of any others.

----------

## Ancestor

I switched to OpenDNS for a while, but now I'm back to my old DNS servers..

and I haven't met the problem again for last few days (with both OpenDNS and my old DNS servers), but I don't know if I can mark this problem as solved..

but anyway, thanks for all your help

if I get some new data, I'll post it here

----------

