You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/03/11 15:03:00 UTC

[jira] [Commented] (AMQ-8183) Setting a maxFrameSize can lead to infinite loop and high cpu usage

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

ASF subversion and git services commented on AMQ-8183:
------------------------------------------------------

Commit 944ca6c7e1dc4f44b61ce05b77c180c686e2ae76 in activemq's branch refs/heads/master from Christopher L. Shannon (cshannon)
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=944ca6c ]

AMQ-8183 - prevent infinite loop when maxFrameSize is exceeded

This makes sure the nio transport thread properly terminates if
maxFrameSize is exceeded with OpenWire to prevent an infinite loop that
uses up all the cpu


> Setting a maxFrameSize can lead to infinite loop and high cpu usage
> -------------------------------------------------------------------
>
>                 Key: AMQ-8183
>                 URL: https://issues.apache.org/jira/browse/AMQ-8183
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.16.1
>            Reporter: Christopher L. Shannon
>            Assignee: Christopher L. Shannon
>            Priority: Major
>             Fix For: 5.17.0, 5.16.2
>
>
> There is a regression caused by AMQ-7106 that can lead to an infinite loop and high cpu usage when using the nio+ssl transport if maxFrameSize is configured. The issue shows up when several messages come into the broker that exceed the max frame size. The broker properly detects the error and kills the connection in another thread but the transport thread can get stuck in an infinite loop inside serviceRead() method of NIOSSLTransport.
> It's a bit hard to tell what is going on but the issue appears to be due to the fact that the transport has already been stopped but there's no condition being hit to break the loop. The transport logic appears to get into a weird state trying to process a partial frame in a local buffer in the serviceRead() method but the logic just keeps spinning and never tries to re-read from the socket because the currentBuffer in the transport is wasn't allocated due to the async shutdown.
> The fix here is pretty simple and that is to check if the transport has been stopped and exit the loop. I have only seen this with OpenWire and nio+ssl but the fix I'm adding will work for all nio+ssl and nio transports.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)