1

How can I diagnose a slow loopback interface? Here is what I see on my Fedora23 box:

$ time ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 17881  bytes 39772920 (37.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17881  bytes 39772920 (37.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


real    0m2.230s
user    0m0.001s
sys     0m0.001s

On all my other boxes the same command executes in 0.001s.

EDIT: full output from strace:

$ strace -r -s9999 ifconfig lo
     0.000000 execve("/usr/sbin/ifconfig", ["ifconfig", "lo"], [/* 51 vars */]) = 0
     0.000407 brk(0)                    = 0x5612d2cae000
     0.000082 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c9000
     0.000062 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
     0.000069 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
     0.000062 fstat(3, {st_mode=S_IFREG|0644, st_size=124105, ...}) = 0
     0.000053 mmap(NULL, 124105, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1bbc7a0000
     0.000051 close(3)                  = 0
     0.000063 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
     0.000056 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\6\2\0\0\0\0\0@\0\0\0\0\0\0\0P\1 \0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0J\0I\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\340\336\30\0\0\0\0\0\340\336\30\0\0\0\0\0\340\336\30\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\fn\33\0\0\0\0\0\fn\33\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0\240w\33\0\0\0\0\0\240w;\0\0\0\0\0\240w;\0\0\0\0\0\240O\0\0\0\0\0\0\240\222\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\200\253\33\0\0\0\0\0\200\253;\0\0\0\0\0\200\253;\0\0\0\0\0\360\1\0\0\0\0\0\0\360\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0D\0\0\0\0\0\0\0D\0\0\0\0\0\0\0\4\0\0\0\0\0\0\0\7\0\0\0\4\0\0\0\240w\33\0\0\0\0\0\240w;\0\0\0\0\0\240w;\0\0\0\0\0\20\0\0\0\0\0\0\0x\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0P\345td\4\0\0\0\374\336\30\0\0\0\0\0\374\336\30\0\0\0\0\0\374\336\30\0\0\0\0\0\24T\0\0\0\0\0\0\24T\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0\240w\33\0\0\0\0\0\240w;\0\0\0\0\0\240w;\0\0\0\0\0`8\0\0\0\0\0\0`8\0\0\0\0\0\0\1\0\0\0\0\0\0\0\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\360\217\3239R\367\366\240\321\261$F\337\20u\332G\330/M\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0 \0\0\0\0\0\0\0\363\3\0\0\n\0\0\0\0\1\0\0\16\0\0\0\0000\20D\240 \2\1\210\3\346\220\305E\214\0\304\0\10\0\5\204\0`\300\200\0\r\212\f\0\4\20\0\210@2\10*@\210P<, \0162H&\204\300\214\4\10\0\2\2\16\241\254\32\4f\300\0\3002\0\300\0P\1 \201\10\204\v  ($\0\4 P\0\20X\200\312DB(\0\6\200\20\30B\0 @\200\0IP\0Q\212@\22\0\0\0\0\10\0\0\21\20", 832) = 832
     0.000086 fstat(3, {st_mode=S_IFREG|0755, st_size=2102224, ...}) = 0
     0.000051 mmap(NULL, 3934784, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1bbc1d8000
     0.000056 mprotect(0x7f1bbc38f000, 2097152, PROT_NONE) = 0
     0.000057 mmap(0x7f1bbc58f000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b7000) = 0x7f1bbc58f000
     0.000062 mmap(0x7f1bbc595000, 14912, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc595000
     0.000061 close(3)                  = 0
     0.000064 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c8000
     0.000056 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c7000
     0.000060 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c6000
     0.000057 arch_prctl(ARCH_SET_FS, 0x7f1bbc7c7700) = 0
     0.000132 mprotect(0x7f1bbc58f000, 16384, PROT_READ) = 0
     0.000084 mprotect(0x5612d2153000, 4096, PROT_READ) = 0
     0.000054 mprotect(0x7f1bbc7c0000, 4096, PROT_READ) = 0
     0.000052 munmap(0x7f1bbc7a0000, 124105) = 0
     0.000148 brk(0)                    = 0x5612d2cae000
     0.000048 brk(0x5612d2ccf000)       = 0x5612d2ccf000
     0.000046 brk(0)                    = 0x5612d2ccf000
     0.000053 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
     0.000064 fstat(3, {st_mode=S_IFREG|0644, st_size=110439232, ...}) = 0
     0.000051 mmap(NULL, 110439232, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1bb5880000
     0.000056 close(3)                  = 0
     0.000092 uname({sysname="Linux", nodename="f23hop.local", ...}) = 0
     0.000077 access("/proc/net", R_OK) = 0
     0.000091 access("/proc/net/unix", R_OK) = 0
     0.000071 socket(PF_LOCAL, SOCK_DGRAM, 0) = 3
     0.000083 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
     0.000067 access("/proc/net/if_inet6", R_OK) = 0
     0.000066 socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 5
     0.000065 access("/proc/net/ax25", R_OK) = -1 ENOENT (No such file or directory)
     0.000065 access("/proc/net/nr", R_OK) = -1 ENOENT (No such file or directory)
     0.000062 access("/proc/net/rose", R_OK) = -1 ENOENT (No such file or directory)
     0.000063 access("/proc/net/ipx", R_OK) = -1 ENOENT (No such file or directory)
     0.000062 access("/proc/net/appletalk", R_OK) = -1 ENOENT (No such file or directory)
     0.000070 access("/proc/sys/net/ash", R_OK) = -1 ENOENT (No such file or directory)
     0.000066 access("/proc/net/x25", R_OK) = -1 ENOENT (No such file or directory)
     0.000080 open("/proc/net/dev", O_RDONLY) = 6
     0.000080 fstat(6, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
     0.000058 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c5000
     0.000063 read(6, "Inter-|   Receive                                                |  Transmit\n face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed\nwlp4s0f0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0\n    lo:     340       4    0    0    0     0          0         0      340       4    0    0    0     0       0          0\nenp1s0:  852201    5484    0    0    0     0          0       537   277020    2388    0    0    0     0       0          0\n", 1024) = 571
     0.000179 close(6)                  = 0
     0.000056 munmap(0x7f1bbc7c5000, 4096) = 0
     0.000065 ioctl(5, SIOCGIFFLAGS, {ifr_name="lo", ifr_flags=IFF_UP|IFF_LOOPBACK|IFF_RUNNING}) = 0
     0.000061 ioctl(5, SIOCGIFHWADDR, {ifr_name="lo", ifr_hwaddr=00:00:00:00:00:00}) = 0
     0.000056 ioctl(5, SIOCGIFMTU, {ifr_name="lo", ifr_mtu=65536}) = 0
     0.000054 ioctl(5, SIOCGIFMAP, {ifr_name="lo", ifr_map={mem_start=0, mem_end=0, base_addr=0, irq=0, dma=0, port=0}}) = 0
     0.000056 ioctl(5, SIOCGIFMAP, {ifr_name="lo", ifr_map={mem_start=0, mem_end=0, base_addr=0, irq=0, dma=0, port=0}}) = 0
     0.000054 ioctl(5, SIOCGIFTXQLEN, {ifr_name="lo", ifr_qlen=0}) = 0
     0.000064 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 6
     0.000063 fstat(6, {st_mode=S_IFREG|0644, st_size=2997, ...}) = 0
     0.000055 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c5000
     0.000055 read(6, "# Locale name alias data base.\n# Copyright (C) 1996-2015 Free Software Foundation, Inc.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2, or (at your option)\n# any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <http://www.gnu.org/licenses/>.\n\n# The format of this file is the same as for the corresponding file of\n# the X Window System, which normally can be found in\n#\t/usr/lib/X11/locale/locale.alias\n# A single line contains two fields: an alias and a substitution value.\n# All entries are case independent.\n\n# Note: This file is obsolete and is kept around for the time being for\n# backward compatibility.  Nobody should rely on the names defined here.\n# Locales should always be specified by their full name.\n\n# Note: This file used to contain the following lines:\n#\tbokmaal\t\tnb_NO.ISO-8859-1\n#\tfranc,ais\tfr_FR.ISO-8859-1\n# except that the \"aa\" was actually the byte '\\0xE5' (the Latin-1\n# encoding for U+00E5 LATIN SMALL LETTER A WITH RING ABOVE) and the\n# \"c,\" was actually the byte '\\xE7' (the Latin-1 encoding for U+00E7\n# LATIN SMALL LETTER C WITH CEDILLA).  These lines were removed\n# because they caused 'locale -a' to output text encoded in Latin-1,\n# which broke applications in UTF-8 locales.  See:\n# https://sourceware.org/bugzilla/show_bug.cgi?id=18412\n\nbokmal\t\tnb_NO.ISO-8859-1\ncatalan\t\tca_ES.ISO-8859-1\ncroatian\thr_HR.ISO-8859-2\nczech\t\tcs_CZ.ISO-8859-2\ndanish          da_DK.ISO-8859-1\ndansk\t\tda_DK.ISO-8859-1\ndeutsch\t\tde_DE.ISO-8859-1\ndutch\t\tnl_NL.ISO-8859-1\neesti\t\tet_EE.ISO-8859-1\nestonian\tet_EE.ISO-8859-1\nfinnish         fi_FI.ISO-8859-1\nfrench\t\tfr_FR.ISO-8859-1\ngalego\t\tgl_ES.ISO-8859-1\ngalician\tgl_ES.ISO-8859-1\ngerman\t\tde_DE.ISO-8859-1\ngreek           el_GR.ISO-8859-7\nhebrew          he_IL.ISO-8859-8\nhrvatski\thr_HR.ISO-8859-2\nhungarian       hu_HU.ISO-8859-2\nicelandic       is_IS.ISO-8859-1\nitalian         it_IT.ISO-8859-1\njapanese\tja_JP.eucJP\njapanese.euc\tja_JP.eucJP\nja_JP\t\tja_JP.eucJP\nja_JP.ujis\tja_JP.eucJP\njapanese.sjis\tja_JP.SJIS\nkorean\t\tko_KR.eucKR\nkorean.euc \tko_KR.eucKR\nko_KR\t\tko_KR.eucKR\nlithuanian      lt_LT.ISO-8859-13\nno_NO\t\tnb_NO.ISO-8859-1\nno_NO.ISO-8859-1 nb_NO.ISO-8859-1\nnorwegian       nb_NO.ISO-8859-1\nnynorsk\t\tnn_NO.ISO-8859-1\npolish          pl_PL.ISO-8859-2\nportuguese      pt_PT.ISO-8859-1\nromanian        ro_RO.ISO-8859-2\nrussian         ru_RU.ISO-8859-5\nslovak          sk_SK.ISO-8859-2\nslovene         sl_SI.ISO-8859-2\nslovenian       sl_SI.ISO-8859-2\nspanish         es_ES.ISO-8859-1\nswedish         sv_SE.ISO-8859-1\nthai\t\tth_TH.TIS-620\nturkish         tr_TR.ISO-8859-9\n", 4096) = 2997
     0.000148 read(6, "", 4096)         = 0
     0.000053 close(6)                  = 0
     0.000051 munmap(0x7f1bbc7c5000, 4096) = 0
     0.000089 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/net-tools.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
     0.000059 open("/usr/share/locale/en_US.utf8/LC_MESSAGES/net-tools.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
     0.000057 open("/usr/share/locale/en_US/LC_MESSAGES/net-tools.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
     0.000058 open("/usr/share/locale/en.UTF-8/LC_MESSAGES/net-tools.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
     0.000056 open("/usr/share/locale/en.utf8/LC_MESSAGES/net-tools.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
     0.000057 open("/usr/share/locale/en/LC_MESSAGES/net-tools.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
     0.000069 ioctl(4, SIOCGIFADDR, {ifr_name="lo", ifr_addr={AF_INET, inet_addr("127.0.0.1")}}) = 0
     1.237654 ioctl(4, SIOCGIFDSTADDR, {ifr_name="lo", ifr_dstaddr={AF_INET, inet_addr("127.0.0.1")}}) = 0
     0.000085 ioctl(4, SIOCGIFBRDADDR, {ifr_name="lo", ifr_broadaddr={AF_INET, inet_addr("0.0.0.0")}}) = 0
     0.000067 ioctl(4, SIOCGIFNETMASK, {ifr_name="lo", ifr_netmask={AF_INET, inet_addr("255.0.0.0")}}) = 0
     0.000120 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
     0.000070 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c5000
     0.000095 write(1, "lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\n", 45lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
) = 45
     0.000090 write(1, "        inet 127.0.0.1  netmask 255.0.0.0\n", 42        inet 127.0.0.1  netmask 255.0.0.0
) = 42
     0.000080 open("/proc/net/if_inet6", O_RDONLY) = 6
     0.000169 fstat(6, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
     0.000237 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1bbc7c4000
     0.000082 read(6, "00000000000000000000000000000001 01 80 10 80       lo\nfe800000000000009eb654fffeb9ee8e 02 40 20 80   enp1s0\n", 1024) = 108
     0.000146 write(1, "        inet6 ::1  prefixlen 128  scopeid 0x10<host>\n", 53        inet6 ::1  prefixlen 128  scopeid 0x10<host>
) = 53
     0.000087 read(6, "", 1024)         = 0
     0.000062 read(6, "", 1024)         = 0
     0.000054 close(6)                  = 0
     0.000058 munmap(0x7f1bbc7c4000, 4096) = 0
     0.000072 write(1, "        loop  txqueuelen 0  (Local Loopback)\n", 45        loop  txqueuelen 0  (Local Loopback)
) = 45
     0.000078 write(1, "        RX packets 4  bytes 340 (340.0 B)\n", 42        RX packets 4  bytes 340 (340.0 B)
) = 42
     0.000079 write(1, "        RX errors 0  dropped 0  overruns 0  frame 0\n", 52        RX errors 0  dropped 0  overruns 0  frame 0
) = 52
     0.000068 write(1, "        TX packets 4  bytes 340 (340.0 B)\n", 42        TX packets 4  bytes 340 (340.0 B)
) = 42
     0.000067 write(1, "        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n", 67        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
) = 67
     0.000062 write(1, "\n", 1
)         = 1
     0.000058 close(5)                  = 0
     0.000064 exit_group(0)             = ?
     0.000217 +++ exited with 0 +++
5
  • 1
    May be you miss 127.0.0.1 record in /etc/hosts?
    – anx
    Feb 23, 2016 at 21:53
  • 1
    I checked it already, it's there.
    – mss
    Feb 23, 2016 at 21:58
  • Can you paste the entire strace output? What options did you use when running strace? Feb 24, 2016 at 0:28
  • the entire output is in the question now
    – mss
    Feb 24, 2016 at 2:32
  • strace shows that the time is spent either in the SIOCGIFADDR system call or in user mode after the end of that system call before the next. If you try with strace -T you should be able to find out if the time was spent in user mode or kernel mode.
    – kasperd
    Nov 3, 2016 at 18:58

0

You must log in to answer this question.

Browse other questions tagged .