[ 
https://issues.apache.org/jira/browse/QPID-6189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413508#comment-15413508
 ] 

Keith Wall commented on QPID-6189:
----------------------------------

Just for the record, this defect causes a stacktrace that looks like this:

{noformat}

Active session count: 2: java.lang.StackOverflowError
        at 
org.apache.qpid.client.AMQConnection.exceptionReceived(AMQConnection.java:1289)
        at 
org.apache.qpid.client.protocol.AMQProtocolHandler.exception(AMQProtocolHandler.java:348)
        at 
org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:217)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.StackOverflowError
        at 
org.apache.qpid.codec.AMQDecoder$RemainingByteArrayInputStream.read(AMQDecoder.java:142)
        at 
org.apache.qpid.codec.AMQDecoder$RemainingByteArrayInputStream.read(AMQDecoder.java:150)
        at 
org.apache.qpid.codec.AMQDecoder$RemainingByteArrayInputStream.read(AMQDecoder.java:150)
        at 
org.apache.qpid.codec.AMQDecoder$RemainingByteArrayInputStream.read(AMQDecoder.java:150)
        at 
org.apache.qpid.codec.AMQDecoder$RemainingByteArrayInputStream.read(AMQDecoder.java:150)
        at 
org.apache.qpid.codec.AMQDecoder$RemainingByteArrayInputStream.read(AMQDecoder.java:150)
{noformat}

> [Java Common] 0-8/9/9-1 parser can cause stack overflow if a frame is broken 
> into many TCP reads/writes
> -------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-6189
>                 URL: https://issues.apache.org/jira/browse/QPID-6189
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Common
>            Reporter: Rob Godfrey
>            Assignee: Rob Godfrey
>             Fix For: 0.31
>
>
> When an entire frame is split over many TCP reads/writes the 0-8/9/9-1 codec 
> is effectively using tail recursion to iterate over the buffers to parse the 
> whole frame.  When there are a lot of buffers this can cause stack overflow.  
> To guard against this we can simply squash the multiple buffers into a single 
> buffer when we cross a threshold number of buffers.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to