oopooa opened a new issue, #8456:
URL: https://github.com/apache/rocketmq/issues/8456

   ### Before Creating the Bug Report
   
   - [X] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [X] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [X] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   Win10
   
   ### RocketMQ version
   
   develop
   
   ### JDK Version
   
   _No response_
   
   ### Describe the Bug
   
   ```java
   Runnable run = buildProcessRequestHandler(ctx, cmd, pair, opaque);
   
   if (isShuttingDown.get()) {
       if (cmd.getVersion() > MQVersion.Version.V5_1_4.ordinal()) {
           final RemotingCommand response = 
RemotingCommand.createResponseCommand(ResponseCode.GO_AWAY,
               "please go away");
           response.setOpaque(opaque);
           writeResponse(ctx.channel(), cmd, response);
           return;
       }
   }
   
   if (pair.getObject1().rejectRequest()) {
       final RemotingCommand response = 
RemotingCommand.createResponseCommand(RemotingSysResponseCode.SYSTEM_BUSY,
           "[REJECTREQUEST]system busy, start flow control for a while");
       response.setOpaque(opaque);
       writeResponse(ctx.channel(), cmd, response);
       return;
   }
   
   try {
       final RequestTask requestTask = new RequestTask(run, ctx.channel(), cmd);
       //async execute task, current thread return directly
       pair.getObject2().submit(requestTask);
   } catch (RejectedExecutionException e) {
       if ((System.currentTimeMillis() % 10000) == 0) {
           log.warn(RemotingHelper.parseChannelRemoteAddr(ctx.channel())
               + ", too many requests and system thread pool busy, 
RejectedExecutionException "
               + pair.getObject2().toString()
               + " request code: " + cmd.getCode());
       }
   
       final RemotingCommand response = 
RemotingCommand.createResponseCommand(RemotingSysResponseCode.SYSTEM_BUSY,
           "[OVERLOAD]system busy, start flow control for a while");
       response.setOpaque(opaque);
       writeResponse(ctx.channel(), cmd, response);
   } catch (Throwable e) {
       AttributesBuilder attributesBuilder = 
RemotingMetricsManager.newAttributesBuilder()
           .put(LABEL_REQUEST_CODE, 
RemotingHelper.getRequestCodeDesc(cmd.getCode()))
           .put(LABEL_RESULT, RESULT_PROCESS_REQUEST_FAILED);
       
RemotingMetricsManager.rpcLatency.record(cmd.getProcessTimer().elapsed(TimeUnit.MILLISECONDS),
 attributesBuilder.build());
   }
   ```
   
   The run instance was created prematurely. Since the code may return directly 
in the upcoming judgement statements, the run instance may become useless.
   
   ### Steps to Reproduce
   
   no need to do that
   
   ### What Did You Expect to See?
   
   instance was created at the right moment
   
   ### What Did You See Instead?
   
   instance was created prematurely
   
   ### Additional Context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to