# [SOLVED] Netstat loops almost infinitely

## kuteninja

This is the output for "netstat -an", as you can see it repeats every time you find a LISTEN for the lighttpd server

```
Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

tcp        0      0 190.210.132.51:80       190.104.162.8:56308     SYN_RECV

tcp        0      0 190.210.132.51:80       190.225.198.35:1279     SYN_RECV

tcp        0      0 190.210.132.51:80       200.120.99.74:50326     SYN_RECV

tcp        0      0 190.210.132.51:80       190.41.79.103:1131      SYN_RECV

tcp        0      0 190.210.132.51:80       72.30.161.218:42639     SYN_RECV

tcp        0      0 190.210.132.51:80       189.139.49.157:11999    SYN_RECV

tcp        0      0 190.210.132.51:80       186.58.54.232:3461      SYN_RECV

tcp        0      0 190.210.132.51:80       190.13.199.10:3542      SYN_RECV

tcp        0      0 190.210.132.51:80       189.174.202.136:19287   SYN_RECV

tcp        0      0 190.210.132.51:80       186.128.6.250:18174     SYN_RECV

tcp        0      0 190.210.132.51:80       201.138.27.3:56881      SYN_RECV

tcp        0      0 190.210.132.51:80       189.128.18.127:51161    SYN_RECV

tcp        0      0 190.210.132.51:80       189.166.230.128:11222   SYN_RECV

tcp        0      0 190.210.132.51:80       190.66.114.80:10636     SYN_RECV

tcp        0      0 190.210.132.51:80       201.241.120.126:56398   SYN_RECV

tcp        0      0 190.210.132.51:80       190.30.76.146:1127      SYN_RECV

tcp        0      0 190.210.132.51:80       201.250.191.134:11867   SYN_RECV

tcp        0      0 190.210.132.51:80       187.138.33.157:20279    SYN_RECV

tcp        0      0 190.210.132.51:80       187.138.33.157:20285    SYN_RECV

tcp        0      0 190.210.132.51:80       187.138.33.157:20284    SYN_RECV

tcp        0      0 190.210.132.51:80       200.87.18.62:1387       SYN_RECV

tcp        0      0 190.210.132.51:80       190.185.134.28:2356     SYN_RECV

tcp        0      0 190.210.132.51:80       189.187.99.73:16937     SYN_RECV

tcp        0      0 190.210.132.51:80       201.241.120.126:56399   SYN_RECV

tcp        0      0 190.210.132.51:80       189.222.189.183:4717    SYN_RECV

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

tcp        0      0 190.210.132.51:80       190.104.162.8:56308     SYN_RECV

tcp        0      0 190.210.132.51:80       190.225.198.35:1279     SYN_RECV

tcp        0      0 190.210.132.51:80       200.120.99.74:50326     SYN_RECV

tcp        0      0 190.210.132.51:80       190.41.79.103:1131      SYN_RECV

tcp        0      0 190.210.132.51:80       72.30.161.218:42639     SYN_RECV

tcp        0      0 190.210.132.51:80       189.139.49.157:11999    SYN_RECV

tcp        0      0 190.210.132.51:80       186.58.54.232:3461      SYN_RECV

tcp        0      0 190.210.132.51:80       190.13.199.10:3542      SYN_RECV

tcp        0      0 190.210.132.51:80       189.174.202.136:19287   SYN_RECV

tcp        0      0 190.210.132.51:80       186.128.6.250:18174     SYN_RECV

tcp        0      0 190.210.132.51:80       201.138.27.3:56881      SYN_RECV

tcp        0      0 190.210.132.51:80       189.128.18.127:51161    SYN_RECV

tcp        0      0 190.210.132.51:80       189.166.230.128:11222   SYN_RECV

tcp        0      0 190.210.132.51:80       190.66.114.80:10636     SYN_RECV

tcp        0      0 190.210.132.51:80       201.241.120.126:56398   SYN_RECV

tcp        0      0 190.210.132.51:80       190.30.76.146:1127      SYN_RECV

tcp        0      0 190.210.132.51:80       201.250.191.134:11867   SYN_RECV

tcp        0      0 190.210.132.51:80       187.138.33.157:20279    SYN_RECV

tcp        0      0 190.210.132.51:80       187.138.33.157:20285    SYN_RECV

tcp        0      0 190.210.132.51:80       187.138.33.157:20284    SYN_RECV

tcp        0      0 190.210.132.51:80       200.87.18.62:1387       SYN_RECV

tcp        0      0 190.210.132.51:80       190.185.134.28:2356     SYN_RECV

tcp        0      0 190.210.132.51:80       189.187.99.73:16937     SYN_RECV

tcp        0      0 190.210.132.51:80       201.241.120.126:56399   SYN_RECV

tcp        0      0 190.210.132.51:80       189.222.189.183:4717    SYN_RECV

tcp        0      0 190.210.132.51:80       187.144.218.99:24639    SYN_RECV

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

(and it keeps repeating... I think you got the idea)
```

I wasn't able to find something wrong on it. 

We have other servers with the same setup as this and this is the only one that fails like this. 

I've already tried removing and re-emerging net-tools, with no change on the output.

I've also tried updating the kernel with no different results.

Also tried rebooting it to check if it wasn't some memory cache issue, but it's still there, although when it starts it doesn't have this issue, it's after I turn on the lighttpd that it starts to loop eternally.

This is some other useful data:

emerge --info:

```
Portage 2.1.9.50 (default/linux/amd64/10.0, gcc-4.5.2, glibc-2.13-r2, 2.6.37-gentoo-r1 x86_64)

=================================================================

System uname: Linux-2.6.37-gentoo-r1-x86_64-Intel-R-_Core-TM-_i7_CPU_860_@_2.80GHz-with-gentoo-2.0.2

Timestamp of tree: Wed, 20 Jul 2011 02:45:01 +0000

app-shells/bash:          4.2_p10

dev-lang/python:          2.7.1-r1, 3.1.3-r1, 3.2

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.0.2

sys-apps/openrc:          0.8.2-r1

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.11.1-r1

sys-devel/binutils:       2.21

sys-devel/gcc:            4.5.2

sys-devel/gcc-config:     1.4.1-r1

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82

sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)

sys-libs/glibc:           2.13-r2

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="http://gentoo.localhost.net.ar/ ftp://mirrors.localhost.net.ar/pub/mirrors/gentoo http://gentoo.mirrors.pair.com/ http://www.las.ic.unicamp.br/pub/gentoo/ ftp://ftp.las.ic.unicamp.br/pub/gentoo/"

LANG="en_US.UTF8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j9"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.samerica.gentoo.org/gentoo-portage"

USE="acl amd64 berkdb bzip2 cli cracklib crypt cups cxx dri fortran gdbm gpm iconv mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline session sse sse2 ssl sysfs tcpd unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

Last edited by kuteninja on Fri Aug 19, 2011 7:10 pm; edited 1 time in total

----------

## kuteninja

BTW, I've said "almost" infinitely, since a count actually told me a finite value... but some big kind of unreal one.

~ # netstat -an | wc -l

2106947

On a different server with the same setup, and on the same round-robbin setup, the result is really more acceptable:

~ # netstat -an | wc -l

28626

----------

## kuteninja

It got fixed by running an emerge -DNuv system, updating to the kernel 3.0.3 and doing a final reboot to load it  :Very Happy: 

----------

