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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0.0-incubating
    • 4.0.0-incubating
    • rocketmq-broker
    • 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);

      }

      Attachments

        Activity

          People

            yukon Xinyu Zhou
            halupipi libin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: