[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-cxx-dev
Subject:    Re: CXX-DEV: Interrupting a blocking read on socket
From:       Eyal Alaluf <eyala () mainsoft ! com>
Date:       2000-12-27 7:59:59
[Download RAW message or body]

Hi, Sreenivas.

We had a similar hang in our case which is (sometimes) very heavily
multithreaded. In our case the 'recv' system call blocked for no apparent
reason.
Today I suspect that the reason was that during the recv the other side of
the socket hanged up and the recv did not return an error status.
Our workaround had been to use select before the recv and do the recv only
after the select indicated the socket is ready. After that we no longer had
any hangs.

Eyal.

On Tue, 26 Dec 2000, Sreenivas Kotapati wrote:

> Date: Tue, 26 Dec 2000 16:04:53 -0700
> From: Sreenivas Kotapati <skotapa@uswest.com>
> To: "cxx-dev@cxx.cup.hp.com" <cxx-dev@cxx.cup.hp.com>
> Subject: CXX-DEV: Interrupting a blocking read on socket
> 
> Hi,
> 
> I have a multi threaded application using pthreads. The application runs
> on HP 10.20 using DCE. There ar couple of threads in the application
> waiting in the accept() system call (just waiting for connection to be
> made by client).  I do read() from the socket and process the request.
> So for so good.
> 
> Once I started inducing system() system call, read() system call is
> blocking and consequently my entire application is hanging. Then I went
> to HP manual  on pthreads. The manual says that "if you issue any HP
> services (meaning system calls), that would block the entire process
> until it is done, and you need to use reentrant system calls".  In this
> case it never comes out of read().
> 
> ( I needed to use system() system call to send email & fax to clients
> from the application)
> 
> My question
> 
> a) why the read on socket is blocking when I have system() system call
> in my application?
> 
> b) Does the system() system call is tampering with socket file
> descriptor flags?
> 
> c) Is it not advisable to use system() system call from a threaded
> application
> 
> d) What is the work around for this kind of situations
> 
> I sincerely appreciate your responses
> 
> Thanks.
> Sreenivas Kotapati
> 
>  _________________________________________________________________
>  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
>     with the message UNSUBSCRIBE cxx-dev
>  _________________________________________________________________
> 

 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE cxx-dev
 _________________________________________________________________

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic