Uploaded image for project: 'Apache RocketMQ'
  1. Apache RocketMQ
  2. ROCKETMQ-22

new funciton 'printWaterMark' in version 3.5.8(4.0.0) will cause a ClassCastException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0.0-incubating
    • Fix Version/s: 4.0.0-incubating
    • Component/s: rocketmq-broker
    • Labels:
      None

      Description

      ew funciton 'printWaterMark' in version 3.5.8(4.0.0) will cause a ClassCastException;

      printWaterMark.headSlowTimeMills4PullThreadPoolQueue.headSlowTimeMills

      public long headSlowTimeMills(BlockingQueue<Runnable> q) {
      long slowTimeMills = 0;
      final Runnable peek = q.peek();
      if (peek != null) {

      RequestTask rt = BrokerFastFailure.castRunnable(peek);

      slowTimeMills = this.messageStore.now() - rt.getCreateTimestamp();
      }

      if (slowTimeMills < 0) slowTimeMills = 0;

      return slowTimeMills;
      }

      in BrokerFastFailure.castRunnable, it will cast runnable to RequestTask

      public static RequestTask castRunnable(final Runnable runnable) {
      try {
      FutureTaskExt object = (FutureTaskExt) runnable;

      return (RequestTask) object.getRunnable();

      ...
      }

      return null;
      }

      but in a specail condition, it don't submit a RequestTask, so cause a ClassCastException

      this.brokerController.getPullMessageProcessor().excuteRequestWhenWakeup(request.getClientChannel(), request.getRequestCommand());

      public void excuteRequestWhenWakeup(final Channel channel, final RemotingCommand request) throws RemotingCommandException {

      Runnable run = new Runnable() {

      @Override
      public void run() {
      try {
      final RemotingCommand response = PullMessageProcessor.this.processRequest(channel, request, false);
      ....

      this.brokerController.getPullMessageExecutor().submit(run);

      }

        Activity

        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 6e31d864e3f49b1296bad2e24955bee4d918d31d in incubator-rocketmq's branch refs/heads/master from yukon
        [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=6e31d86 ]

        ROCKETMQ-22 Resolve ClassCastException issue in printWaterMark.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 6e31d864e3f49b1296bad2e24955bee4d918d31d in incubator-rocketmq's branch refs/heads/master from yukon [ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=6e31d86 ] ROCKETMQ-22 Resolve ClassCastException issue in printWaterMark.

          People

          • Assignee:
            Yukon yukon
            Reporter:
            halupipi libin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development