activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQCPP-203) Segmentation Fault in Integration tests occurs occasionally.
Date Tue, 04 Nov 2008 16:07:05 GMT

    [ https://issues.apache.org/activemq/browse/AMQCPP-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47055#action_47055
] 

Timothy Bish commented on AMQCPP-203:
-------------------------------------

The BufferedInputStream class doesn't know anything about sockets or threads, its just a dumb
buffered reader, the real manager of the sockets and threads code is in the IOTransport which
first closes its input stream which at its root is a wrapper around a SocketInputStream, so
when the read thread calls read on its input stream it will break because the socket is closed,
the transport then waits on the Read thread to die before finishing its shut-down code.  

Here's a snippet from the IOTransport's close method:

{noformat}
        if( inputStream != NULL ){

            inputStream->close();
            inputStream = NULL;
        }

        // Wait for the thread to die.
        if( thread != NULL ){
            thread->join();
            delete thread;
            thread = NULL;
        }
{noformat}

When the inputStream is closed what you were seeing was that the close method deleted the
buffer, but the read thread was still working its way through the BufferedInputStream's bufferData
method which would eventually hand off to the socket input stream to read more data.  When
it tried to get access to the now deleted buffer you'd see a seg fault.  

At least that's my story.


> Segmentation Fault in Integration tests occurs occasionally.
> ------------------------------------------------------------
>
>                 Key: AMQCPP-203
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-203
>             Project: ActiveMQ C++ Client
>          Issue Type: Sub-task
>          Components: Integration Tests
>    Affects Versions: 2.2.1
>         Environment: CentOS 5.2 / REHL / Fedora 9
>            Reporter: Timothy Bish
>            Assignee: Timothy Bish
>             Fix For: 2.2.2
>
>         Attachments: BufferedInputStream.cpp.patch, segfaults.tar.gz
>
>
> While running the integration tests in a long loop an occasional Segmentation fault has
been seen. 

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


Mime
View raw message