You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Nathan Mittler (JIRA)" <ji...@apache.org> on 2007/04/23 16:19:34 UTC

[jira] Updated: (AMQCPP-107) SocketInputStream::read() doesn't check for EINTR error

     [ https://issues.apache.org/activemq/browse/AMQCPP-107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Mittler updated AMQCPP-107:
----------------------------------

    Fix Version/s: 2.0.1

> SocketInputStream::read() doesn't check for EINTR error
> -------------------------------------------------------
>
>                 Key: AMQCPP-107
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-107
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: CMS Impl
>    Affects Versions: 2.0
>         Environment: UNIX / POSIX
>            Reporter: Matvey Aizenshtat
>         Assigned To: Nathan Mittler
>            Priority: Minor
>             Fix For: 2.0.1
>
>
> From SocketInputSream.cpp:
>     int len = ::recv(socket, (char*)buffer, (int)bufferSize, 0);
>    
>     // Check for a closed socket.
>     if( len == 0 ){
>         throw IOException( __FILE__, __LINE__,
>             "activemq::io::SocketInputStream::read - The connection is broken" );
>     }
>    
>     // Check for error.
>     if( len == -1 ){
>        
>         // Otherwise, this was a bad error - throw an exception.
>         throw IOException( __FILE__, __LINE__,
>                 "activemq::io::SocketInputStream::read - %s", SocketError::getErrorString().c_str() );
>     }
> It's really worth to replace the condition check with smth like this:
> while( errno == EINTR)
> {
>       int len = ::recv(socket, (char*)buffer, (int)bufferSize, 0);
>    
>     if( len == 0 ){
>     ...
>     }
>    
>     if( len == -1 ){
>     ...
>     }
> }
> The above is needed to avoid the situation when blocking read() call was failed due to the interruption by a signal. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.