You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "AlbumenJ (via GitHub)" <gi...@apache.org> on 2023/04/18 06:29:12 UTC

[GitHub] [dubbo] AlbumenJ opened a new pull request, #12118: Support Shutdown Gracefully

AlbumenJ opened a new pull request, #12118:
URL: https://github.com/apache/dubbo/pull/12118

   ## What is the purpose of the change
   
   1. Add `unregister` to `Exporter`
   2. `unregister` first when ServiceConfig `unexport`
   3. wait for service idle in ServiceConfig
   4. `offline` first in `ApplicationModelDeployer` and `ModuleModelDeployer`
   
   ## Brief changelog
   
   
   ## Verifying this change
   
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [ ] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1172378369


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {
+        int timeout = ConfigurationUtils.getServerShutdownTimeout(getScopeModel());
+
+        long idleTime = System.currentTimeMillis() - providerModel.getLastInvokeTime();

Review Comment:
   想一个极端场景:业务服务就是每10s调用一次,会不会在某次请求达到一个正在停机的provider上却处理不了呢。
   



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1175975262


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {

Review Comment:
   Concurrent check can be finished seperately. This PR is focus on wait for consumer not to use the offlined provider.



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1172286982


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {
+        int timeout = ConfigurationUtils.getServerShutdownTimeout(getScopeModel());
+
+        long idleTime = System.currentTimeMillis() - providerModel.getLastInvokeTime();
+
+        // 1. if service has idle for 10s(shutdown time), un-export directly
+        if (idleTime > timeout) {
+            return;
+        }
+
+        // 2. if service has idle for  more than 6.7s(2/3 of shutdown time), wait for the rest time, then un-export directly
+        int tick = timeout / 3;
+        if (timeout - idleTime < tick) {
+            logger.info("Service " + getUniqueServiceName() + " has idle for " + idleTime + " ms, wait for " + (timeout - idleTime) + " ms to un-export");
+            try {
+                Thread.sleep(timeout - idleTime);
+            } catch (InterruptedException e) {
+                logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", e.getMessage(), e);
+                Thread.currentThread().interrupt();
+            }
+            return;
+        }
+
+        // 3. Wait for 3.33s(1/3 of shutdown time), if service has idle for 3.33s(1/3 of shutdown time), un-export directly,
+        //    otherwise wait for the rest time until idle for 3.33s(1/3 of shutdown time). The max wait time is 10s(shutdown time).
+        idleTime = 0;

Review Comment:
   可能最少只等待3.33s?



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1177522069


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -194,6 +196,14 @@ public void unexport() {
             return;
         }
         if (!exporters.isEmpty()) {
+            for (Exporter<?> exporter : exporters) {
+                try {
+                    exporter.unregister();
+                } catch (Throwable t) {
+                    logger.warn(CONFIG_UNEXPORT_ERROR, "", "", "Unexpected error occurred when unexport " + exporter, t);
+                }
+            }
+            waitForIdle();

Review Comment:
   offline 那部分逻辑貌似无法下掉应用级的注册信息。
   org.apache.dubbo.registry.client.ServiceDiscoveryRegistry#unregister
   ![image](https://user-images.githubusercontent.com/7312478/234515264-96ce4d19-5878-4c15-b6a1-f7f2ff4cfff3.png)
   
   org.apache.dubbo.registry.client.AbstractServiceDiscovery#unregister(org.apache.dubbo.common.URL)
   ![image](https://user-images.githubusercontent.com/7312478/234515549-eeaa30ed-eb0f-4fae-bf3d-dd4c5f83cbc2.png)
   



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] sonarcloud[bot] commented on pull request #12118: Support Shutdown Gracefully

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#issuecomment-1514050814

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=12118)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=12118&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=12118&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=12118&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=12118&resolved=false&types=CODE_SMELL)
   
   [![61.1%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '61.1%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12118&metric=new_coverage&view=list) [61.1% Coverage](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12118&metric=new_coverage&view=list)  
   [![23.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20plus-16px.png '23.8%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12118&metric=new_duplicated_lines_density&view=list) [23.8% Duplication](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=12118&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1177645799


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -194,6 +196,14 @@ public void unexport() {
             return;
         }
         if (!exporters.isEmpty()) {
+            for (Exporter<?> exporter : exporters) {
+                try {
+                    exporter.unregister();
+                } catch (Throwable t) {
+                    logger.warn(CONFIG_UNEXPORT_ERROR, "", "", "Unexpected error occurred when unexport " + exporter, t);
+                }
+            }
+            waitForIdle();

Review Comment:
   应用级服务下线需要配合下面的配置。(默认配置最大30s后才同步到注册中心)
   org.apache.dubbo.config.deploy.DefaultApplicationDeployer#registerServiceInstance
   ![image](https://user-images.githubusercontent.com/7312478/234541407-cceeea9a-0958-4c95-b85f-8cf14ab487c5.png)
   



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] CrazyHZM commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "CrazyHZM (via GitHub)" <gi...@apache.org>.
CrazyHZM commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1173239805


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {

Review Comment:
   Graceful offline also needs to consider that the connection is no longer receiving new requests, and the thread pool has completed all tasks within the specified time. Is it possible to check the number of tasks in some thread pools here?
   



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1177306661


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -194,6 +196,14 @@ public void unexport() {
             return;
         }
         if (!exporters.isEmpty()) {
+            for (Exporter<?> exporter : exporters) {
+                try {
+                    exporter.unregister();
+                } catch (Throwable t) {
+                    logger.warn(CONFIG_UNEXPORT_ERROR, "", "", "Unexpected error occurred when unexport " + exporter, t);
+                }
+            }
+            waitForIdle();

Review Comment:
   如果一个dubbo项目有多个接口(ServiceBean),每个ServiceBean进行unexport的时候都需要等待,会导致停机时间变成10*n



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1177314033


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -194,6 +196,14 @@ public void unexport() {
             return;
         }
         if (!exporters.isEmpty()) {
+            for (Exporter<?> exporter : exporters) {
+                try {
+                    exporter.unregister();
+                } catch (Throwable t) {
+                    logger.warn(CONFIG_UNEXPORT_ERROR, "", "", "Unexpected error occurred when unexport " + exporter, t);
+                }
+            }
+            waitForIdle();

Review Comment:
   在 Module、Application 关闭的时候会提前 offline 所有服务。所以理论最长时间只有 10s



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1172288535


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {
+        int timeout = ConfigurationUtils.getServerShutdownTimeout(getScopeModel());
+
+        long idleTime = System.currentTimeMillis() - providerModel.getLastInvokeTime();
+
+        // 1. if service has idle for 10s(shutdown time), un-export directly
+        if (idleTime > timeout) {
+            return;
+        }
+
+        // 2. if service has idle for  more than 6.7s(2/3 of shutdown time), wait for the rest time, then un-export directly
+        int tick = timeout / 3;
+        if (timeout - idleTime < tick) {
+            logger.info("Service " + getUniqueServiceName() + " has idle for " + idleTime + " ms, wait for " + (timeout - idleTime) + " ms to un-export");
+            try {
+                Thread.sleep(timeout - idleTime);
+            } catch (InterruptedException e) {
+                logger.warn(INTERNAL_ERROR, "unknown error in registry module", "", e.getMessage(), e);
+                Thread.currentThread().interrupt();
+            }
+            return;
+        }
+
+        // 3. Wait for 3.33s(1/3 of shutdown time), if service has idle for 3.33s(1/3 of shutdown time), un-export directly,
+        //    otherwise wait for the rest time until idle for 3.33s(1/3 of shutdown time). The max wait time is 10s(shutdown time).
+        idleTime = 0;

Review Comment:
   是的,这里有个时间窗口的决策,时间窗口太小了可能导致推送没到位就关闭了



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ merged pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ merged PR #12118:
URL: https://github.com/apache/dubbo/pull/12118


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1172386087


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {
+        int timeout = ConfigurationUtils.getServerShutdownTimeout(getScopeModel());
+
+        long idleTime = System.currentTimeMillis() - providerModel.getLastInvokeTime();

Review Comment:
   > 想一个极端场景:业务服务就是每10s调用一次,会不会在某次请求达到一个正在停机的provider上却处理不了呢。
   
   不确定我举的这个例子是否正确



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#issuecomment-1516005666

   请问有计划对3.0.x和3.1.x修复这个问题吗 https://github.com/apache/dubbo/issues/12064


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1178596779


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -194,6 +196,14 @@ public void unexport() {
             return;
         }
         if (!exporters.isEmpty()) {
+            for (Exporter<?> exporter : exporters) {
+                try {
+                    exporter.unregister();
+                } catch (Throwable t) {
+                    logger.warn(CONFIG_UNEXPORT_ERROR, "", "", "Unexpected error occurred when unexport " + exporter, t);
+                }
+            }
+            waitForIdle();

Review Comment:
   3.2 目前默认 1s 了



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] QuentinYo commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "QuentinYo (via GitHub)" <gi...@apache.org>.
QuentinYo commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1172237955


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {
+        int timeout = ConfigurationUtils.getServerShutdownTimeout(getScopeModel());
+
+        long idleTime = System.currentTimeMillis() - providerModel.getLastInvokeTime();

Review Comment:
   为什么要根据providerModel.getLastInvokeTime()来计算idleTime呢,应该从unregister完成后开始计算更好吧



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on code in PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#discussion_r1172288066


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java:
##########
@@ -209,6 +219,51 @@ public void unexport() {
         repository.unregisterProvider(providerModel);
     }
 
+    private void waitForIdle() {
+        int timeout = ConfigurationUtils.getServerShutdownTimeout(getScopeModel());
+
+        long idleTime = System.currentTimeMillis() - providerModel.getLastInvokeTime();

Review Comment:
   如果已经 idle 了 10s,认为没有请求了



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on pull request #12118: Support Shutdown Gracefully

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on PR #12118:
URL: https://github.com/apache/dubbo/pull/12118#issuecomment-1521112272

   > 请问有计划对3.0.x和3.1.x修复这个问题吗 #12064
   
   目前暂无计划


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org