YaoHaishi created SCB-1469:
------------------------------
Summary: SCBEngine should abandon unfinished invocations if
waiting for invocation finished is timed out
Key: SCB-1469
URL: https://issues.apache.org/jira/browse/SCB-1469
Project: Apache ServiceComb
Issue Type: Bug
Components: Java-Chassis
Reporter: YaoHaishi
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:
{code:java}
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);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)