<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=520185619-19092008><FONT face=Arial
color=#0000ff size=2>Can you send us a small test case to reproduce the
problem?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=520185619-19092008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=520185619-19092008><FONT face=Arial
color=#0000ff size=2>Rajeev</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> owner-mpich-discuss@mcs.anl.gov
[mailto:owner-mpich-discuss@mcs.anl.gov] <B>On Behalf Of </B>Gisele Machado de
Souza<BR><B>Sent:</B> Thursday, September 18, 2008 11:04 PM<BR><B>To:</B>
mpich-discuss@mcs.anl.gov<BR><B>Subject:</B> [mpich-discuss] Multithread
server using MPICH-2<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>Hello,<BR><BR>I'm implementing a server in MPI that accepts more
than one connection from clients at the same time.<BR>For do that I used
MPI(mpich2-1.1.0a1.tar.gz) and pthreads.<BR><BR>What I want to do is a server
that stays in a infinity loop waiting for connections (MPI_Comm_accept(portMD,
MPI_INFO_NULL, 0, MPI_COMM_WORLD, newCommClient);). When a connection is
established, he creates a new thread and return to wait more
connections. That means, the server and the thread will work in
parallel.<BR><BR>The function that the thread will execute calls mpi
functions, like MPI_probe, MPI_Get_count, MPI_Recv, MPI_Send, MPI_Pack
and MPI_Unpack.<BR><BR>The problem I'm having is that the server and the
thread are not working in parallel successfully. Sometimes, the program hangs,
do nothing, and in another times a fatal error appears (Assertion failed in
file sock_wait.i at line 236: (pollfd->events & (0x001 | 0x004)) ||
pollfd->fd == -1).<BR><BR>When I put the server to sleep for a moment,
before he will wait another connection, during the time he was sleeping the
created thread works fine. Once the server wakes up and starts to wait for a
connection, things stop working.<BR><BR>A peace of my code
(Server):<BR>-----------------------------------------------------------------------------------------------------------------------------<BR>//
arguments passed to a thread<BR>typedef struct<BR>{ MPI_Comm
communicator;<BR> char * path1;<BR> char * path2;<BR> char *
port; <BR>} ThreadParam;<BR><BR> pthread_t
threads[10];<BR> int t =0;<BR> int rc;<BR><BR><BR> ThreadParam
* listParam = NULL;<BR> MPI_Comm * newCommClient;<BR>
<BR><BR> /* server infinity loop */<BR> while (time_out >
10)<BR> {<BR> <BR> newCommClient =
malloc(sizeof(MPI_Comm));<BR> <BR>
<BR> /* waiting for a connection
*/<BR> MPI_Comm_accept(portMD, MPI_INFO_NULL, 0,
MPI_COMM_WORLD,
newCommClient);<BR>
<BR> listParam =
malloc(sizeof(ThreadParam));
<BR> listParam->communicator = *newCommClient;
//with this communicator the thread will talk with
the
/
//client <BR> listParam->path1 =
argv[2];<BR> listParam->path2 =
argv[4];<BR> listParam->port =
portMD;<BR> <BR> rc =
pthread_create(&threads[t], NULL, threadfunc, (void *)
listParam);<BR> <BR> if
(rc){<BR> printf("ERROR;
return code from pthread_create() is %d\n",
rc);<BR>
exit(-1);<BR> }<BR>
//sleep(1); <BR> t++;<BR>
}<BR><BR>-----------------------------------------------------------------------------------------------------------------------------<BR>Please,
I need help to solve this problem!!<BR><BR>Thanks very
mych!<BR><BR>Gisele<BR></DIV></BLOCKQUOTE></BODY></HTML>