Uploaded image for project: 'Apache ServiceComb'
  1. Apache ServiceComb
  2. SCB-1469

SCBEngine should abandon unfinished invocations if waiting for invocation finished is timed out

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • Java-Chassis
    • None

    Description

      When a microservice instance is going to exit, the SCBEngine will block the exit procedure, waiting for all of the invocations in processing status get finished. And in the method SCBEngine#validAllInvocationFinished, the unfinished invocations counter is checked. After waiting for a period of time, if there are still unfinished invocations, the SCBEngine should print error log to warn users about those invocations and exit the process forcely.
      However, currently in the method SCBEngine#validAllInvocationFinished only the error log is printed, but no exit operation is done, leaving the exit procedure still blocked.

      You can find the code segment to be fixed like below in the class SCBEngine:

        private void validAllInvocationFinished() throws InterruptedException {
          long start = System.currentTimeMillis();
          while (true) {
            long remaining = invocationStartedCounter.get() - invocationFinishedCounter.get();
            if (remaining == 0) {
              return;
            }
      
            if (System.currentTimeMillis() - start > TimeUnit.SECONDS.toMillis(30)) {
              LOGGER.error("wait for all requests timeout, abandon waiting, remaining requests: {}.", remaining);
              // since the waiting logic is timed out, should return to exit here
            }
            TimeUnit.SECONDS.sleep(1);
          }
        }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yaohaishi Haishi Yao
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: