Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-963

ClassCastException in ActiveMQChannelHandler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.2
    • 1.5.4, 2.0.0
    • Broker
    • None

    Description

      In WildFly, we use Artemis HTTP upgrade to connect from the Artemis client to the server.
      We also have an older version of Netty (4.0.35.Final) than the one used by Artemis (4.1.5.Final).

      When I upgraded the version of Netty in WildFly to 4.1.5.Final, I found a regression that is causing a ClassCastException in ActiveMQChannelHandler#channelRead where I received a Netty's LastHttpContent.EMPTY_LAST_CONTENT instead of a ByteBuf.

      After some bisect, we found that the actual regression happened with Netty 4.0.37.Final and this PR[1].
      Before Netty 4.0.37.Final, the pipeline was updated in HttpUpgradeHandler#channelRead0 when the HttpResponse (corresponding to the HTTP Upgrade 101 header). Then the following LastHttpContent.EMPTY_LAST_CONTENT was also consumed by it (but we don't care, the handshake was complete and the latch was already countdown).

      However, with Netty 4.0.37.Final, the LastHttpContent.EMPTY_LAST_CONTENT is now handled after the pipeline was updated and it now received by ActiveMQChannelHandler#channelRead. This causes the ClassCastException as this handler is only expecting ByteBuf.

      The code in HttpUpgradeHandler#channelRead0 must be updated so that the pipeline is updated only when the HTTP ugprade handshake is successful and we consume the LastHttpContent.EMPTY_LAST_CONTENT that is added by Netty

      [1] https://github.com/netty/netty/pull/5110

      Attachments

        Activity

          People

            Unassigned Unassigned
            jmesnil Jeff Mesnil
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: