From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Loic Domaigne Newsgroups: gmane.os.tru64.managers Subject: About netstat hangs... Date: Wed, 05 May 2004 17:19:50 +0200 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <40990616.2040302@4dp.dfs.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1083770413 15833 80.91.224.253 (5 May 2004 15:20:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 May 2004 15:20:13 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Wed May 05 17:19:58 2004 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1BLOBh-0007yh-00 for ; Wed, 05 May 2004 17:19:57 +0200 Original-Received: (qmail 16661 invoked by uid 5); 5 May 2004 15:19:50 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 16646 invoked by uid 49501); 5 May 2004 15:19:50 -0000 Original-Received: from loic@ast.dfs.de by sws1 by uid 49491 with qmail-scanner-1.21 (clamdscan: 0.70-rc. iscan: v3.1/v5.600-1011/847/50540. spamassassin: 2.63. Clear:RC:0(160.91.4.119):SA:0(-4.9/5.0):. Processed in 1.644904 secs); 05 May 2004 15:19:50 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 5 May 2004 15:19:48 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0HX8000MNYKZE0@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 05 May 2004 11:19:47 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute1.cind.ornl.gov by emroute1.cind.ornl.gov (PMDF V6.2-X27 #30899) id <0HX800B02YKLH8@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 05 May 2004 11:19:35 -0400 (EDT) Original-Received: from mxl.tiscali.de (mxl.tiscali.de [194.162.162.200]) by emroute1.cind.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0HX800B0UYKKBN@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 05 May 2004 11:19:33 -0400 (EDT) Original-Received: from smdx0101.ast.dfs.de (unknown [195.52.122.81]) by mxl.tiscali.de (Postfix) with ESMTP id A286961E7 for ; Wed, 05 May 2004 17:19:32 +0200 (CEST) Original-Received: from 4dp.dfs.de (wks4.4dp.dfs.de [192.168.0.4]) by smdx0101.ast.dfs.de (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) with ESMTP id RAA16851 for ; Wed, 05 May 2004 17:19:32 +0200 Original-To: tru64-unix-managers@ornl.gov X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 Xref: main.gmane.org gmane.os.tru64.managers:6903 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:6903 Dear Tru64 Managers, I have noticed that many people were faced to the "netstat hangs" problem. But I didn't found a clear answer regarding that issue. I ran two weeks ago in that problem too, and here a summary of my investigations (on Tru64 4.0F, but this might apply to newer Tru64 as well, if I refer to the posts on this list). If a process writes in a message queue in such way that it overflows the queue (for instance, no receiver presents), then when the maximum of oustanding messages is reached (40 on my system), netstat hangs. BTW, not only netstat, but also program like lsof. As soon as the queue is removed, netstat (resp. lsof) works fine again. I believe, this is a Tru64 issue? Since, the only process that should be eventually "punished" is the writer (if IPC_NOWAIT isn't passed to msgflg, the writer should block). However, even if a message queue has kernel persistence, I don't believe that other processes like netstat should block too... Below, you shall find overflowQ.c, a program that does nothing but overflow a message queue, as well a description to reproduce the problem (steps.txt). You might known all of this already... But I felt it would be perhaps a good idea to post that summary. Cheers, Loic. ------------------ overflowQ.c #include #include #include #include #include #include #include #define MSGQ_KEY 0x1234 #define PERM 0660 struct mymsg { long mtype; char mtext[1]; }; int main() { int msg_id; /* message Queue id. */ struct mymsg msg; /* message to send. */ int nmsg; /* number of msg send. */ int status; /* status returned by msgsnd(). */ /* * Create Message Queue */ if ( (msg_id = msgget (MSGQ_KEY, PERM | IPC_CREAT | IPC_EXCL)) == -1 ) { perror ("msgget: "); exit (EXIT_FAILURE); } /* * now write message one by one until Queue is full */ msg.mtype = 1; msg.mtext[0] = 'A'; nmsg = 0; do { status = msgsnd (msg_id, &msg, sizeof(msg.mtext), IPC_NOWAIT); nmsg++; printf ("Sent msg #%d\r", nmsg); } while ( status == 0 ); if (errno != EAGAIN ) { /* eh? we didn't overflow? */ perror ("msgsnd: "); exit (EXIT_FAILURE); } printf ("Queue full, sent %d messages\n", nmsg-1); exit (EXIT_SUCCESS); } ------------------ steps.txt =============================== Steps to reproduce the problem: =============================== bash$ netstat Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp 0 0 vdphr1.sshd wks4.33524 ESTABLISHED tcp 0 0 localhost.3922 localhost.2301 TIME_WAIT tcp 0 0 localhost.3923 localhost.2301 TIME_WAIT ... bash$ overflowQ Queue full, sent 40 messages bash$ netstat [ hangs... ] bash$ ipcs -qa T ID KEY MODE OWNER GROUP CREATOR CGROUP CBYTES QNUM QBYTES LSPID LRPID STIME RTIME CTIME q 0 0x41003ec7 --rw------- root system root system 0 0 16384 3 13647 14:24:29 14:24:29 8:37:07 q 130 0x1234 --rw-rw---- loic vdp loic vdp 40 40 16384 13662 0 14:25:06 no-entry 14:25:06 removing the queue solve the problem: bash$ ipcrm -q 130 bash$ netstat Active Internet connections Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp 0 0 vdphr1.sshd wks4.33524 ESTABLISHED tcp 0 0 localhost.3939 localhost.2301 TIME_WAIT tcp 0 0 localhost.3940 localhost.2301 TIME_WAIT ... Note: there is no need to restart kloadsrv.