tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* About netstat hangs...
@ 2004-05-05 15:19 Loic Domaigne
       [not found] ` <"from loic"@ast.dfs.de>
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Domaigne @ 2004-05-05 15:19 UTC (permalink / raw)


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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <errno.h>

#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.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Command execution in a V5 Cluster vs Non-Cluster environment
       [not found] ` <"from loic"@ast.dfs.de>
@ 2004-05-05 22:09   ` Narendra Raavi
  0 siblings, 0 replies; 2+ messages in thread
From: Narendra Raavi @ 2004-05-05 22:09 UTC (permalink / raw)



Hi,

I've compiled rpm for Tru64 UNIX V5.1B on a NON-Cluster server. The rpm
suite is installed in /opt/rpm which is a link to /usr/common/rpm-4.3.1.
The /usr/common is served by an NFS service residing on a
Tru64 UNIX V4.0F server.

The entire suite of commands work fine on ES40(3cpu 8g mem), DS20(2cpu, 4g
mem) and DS10(1cpu, 1g mem) servers running V5.1B PK#3. These servers are
standalone server and clustering is not installed.

However, the simplest of rpm commands (rpm --version) does not run on

a) one-node V5.1B cluster (ES40 - 4 cpu, 8g mem)
b) two-node V5.1B cluster (two AS4100s - 1 cpu, 1g mem)
c) three-node V5.1B cluster (three ES47s - 4 cpu, 8g mem)

I am stumped. I tried to capture what happens using truss. A fragment of
this is below. The read after the lseek does not happen at all.


==========================NON-CLUSTER server==============================
<......identical output upto this point......>
getsysinfo(67, 0x000000011FFFBE50, 4, 0x00000000, 0x00000000, 0x000003FF8013C284) = 1
brk(0x000000014005B590)                         = 0
open("/opt/rpm/lib/rpm/rpmpopt-4.3.1", O_RDONLY, 00) = 3
lseek(3, 0, SEEK_END)                           = 22064
lseek(3, 0, SEEK_SET)                           = 0
read(3, " # / * !   \ p a g e   c".., 22064)    = 22064
close(3)                                        = 0
open("/etc/popt", O_RDONLY, 013600000)          Err#2  No such file or directory
open("/root/.popt", O_RDONLY, 00)               Err#2  No such file or directory
getuid()                                        = 0  [ 0 ]
getuid()                                        = 0  [ 0 ]
getgid()                                        = 1  [ 1 ]
getgid()                                        = 1  [ 1 ]
ioctl(1, 0x2000745E, 0x00000000)                = 0
RPM version 4.3.1
write(1, " R P M   v e r s i o n  ".., 18)      = 18
sigprocmask(SIG_BLOCK, 0xFFFFF137, 0x00000000)  = 0
_exit(0)
==========================NON-CLUSTER server==============================

==========================CLUSTERed server(s)==============================
<......identical output upto this point......>
getsysinfo(67, 0x000000011FFFBE50, 4, 0x00000000, 0x00000000, 0x000003FF8013C284) = 1
brk(0x000000014005B590)                         = 0
open("/opt/rpm/lib/rpm/rpmpopt-4.3.1", O_RDONLY, 00) = 3
lseek(3, 0, SEEK_END)                           = 22064
lseek(3, 0, SEEK_SET)                           = 0
==========================CLUSTERed server(s)==============================

Any suggestions/hints/solutions are appreciated.

Thanks in advance,

-- 

 -- Narendra Ra[a]vi     Email : narendra@spiff.mt.att.com
    MT  A4-4B27       Phone : 732-420-7792


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-05 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-05 15:19 About netstat hangs Loic Domaigne
     [not found] ` <"from loic"@ast.dfs.de>
2004-05-05 22:09   ` Command execution in a V5 Cluster vs Non-Cluster environment Narendra Raavi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox