You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/04/21 11:18:12 UTC

[GitHub] [apisix-dashboard] bisakhmondal opened a new pull request #1814: fix: store init error from etcd and deferred execution of closers

bisakhmondal opened a new pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814


   Please answer these questions before submitting a pull request, **or your PR will get closed**.
   
   **Why submit this pull request?**
   
   - [x] Bugfix
   - [ ] New feature provided
   - [x] Improve performance
   - [ ] Backport patches
   
   **What changes will this PR take into?**
   
   1. Closing of all opened resource has been put into deferred execution. So incase any panic occurs during runtime, the respective closers of the resource gets executed safely. Till now, for panics, the main goroutine was getting closed ungracefully.
   
   2. Detailed error description if etcd contains corrupted data and exit with nonzero error code.
   ![image](https://user-images.githubusercontent.com/41498427/115544951-de2f6280-a2c0-11eb-8fac-d0de0a234909.png)
   
   **Related issues**
   reopening #1705 
   closes #1684 
   
   
   **Checklist:**
   
   - [x] Did you explain what problem does this PR solve? Or what new features have been added?
   - [x] Have you added corresponding test cases?
   - [ ] Have you modified the corresponding document?
   - [x] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first
   


-- 
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.

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



[GitHub] [apisix-dashboard] tokers merged pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
tokers merged pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814


   


-- 
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.

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



[GitHub] [apisix-dashboard] tokers commented on a change in pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r625537043



##########
File path: api/cmd/managerapi.go
##########
@@ -65,6 +66,14 @@ func printVersion() {
 
 // NewManagerAPICommand creates the manager-api command.
 func NewManagerAPICommand() *cobra.Command {
+	cobra.OnInitialize(func() {
+		var err error
+		service, err = createService()

Review comment:
       Use short variables creation.




-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on a change in pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r627484178



##########
File path: api/internal/utils/pid.go
##########
@@ -26,6 +26,9 @@ import (
 
 // WritePID write pid to the given file path.
 func WritePID(filepath string) error {
+	if _, err := os.Stat(filepath); err == nil {
+		return fmt.Errorf("instance of Manager API already running: a pid file exists in %s", filepath)

Review comment:
       Hii guys, as we are now supporting manager-api as an os service, the PID file should not be overwritten unknowingly, because then `./manager-api stop` won't work. we have to take help from the os service manager explicitly.
   
   > We may add an option to start forcely.
   Yes, we can do that.




-- 
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.

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



[GitHub] [apisix-dashboard] codecov-commenter commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-829943690


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1814](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (836be0d) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/b54c19508e6265775069adee467acbc181b0acaf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b54c195) will **decrease** coverage by `25.18%`.
   > The diff coverage is `53.84%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1814       +/-   ##
   ===========================================
   - Coverage   71.45%   46.27%   -25.19%     
   ===========================================
     Files         172       47      -125     
     Lines        6121     3183     -2938     
     Branches      711        0      -711     
   ===========================================
   - Hits         4374     1473     -2901     
   + Misses       1498     1441       -57     
   - Partials      249      269       +20     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `46.27% <53.84%> (+0.25%)` | :arrow_up: |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `58.33% <0.00%> (-27.90%)` | :arrow_down: |
   | [api/cmd/managerapi.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2NtZC9tYW5hZ2VyYXBpLmdv) | `48.95% <70.00%> (+0.60%)` | :arrow_up: |
   | [api/internal/handler/schema/plugin.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3BsdWdpbi5nbw==) | `15.00% <0.00%> (-85.00%)` | :arrow_down: |
   | [api/internal/handler/tool/tool.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdG9vbC90b29sLmdv) | `13.88% <0.00%> (-80.56%)` | :arrow_down: |
   | [...l/handler/route\_online\_debug/route\_online\_debug.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGVfb25saW5lX2RlYnVnL3JvdXRlX29ubGluZV9kZWJ1Zy5nbw==) | `4.61% <0.00%> (-78.47%)` | :arrow_down: |
   | [api/internal/handler/schema/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3NjaGVtYS5nbw==) | `23.80% <0.00%> (-76.20%)` | :arrow_down: |
   | [api/internal/utils/runtime/runtime.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL3V0aWxzL3J1bnRpbWUvcnVudGltZS5nbw==) | `0.00% <0.00%> (-64.29%)` | :arrow_down: |
   | [api/internal/handler/ssl/ssl.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3NsL3NzbC5nbw==) | `12.04% <0.00%> (-61.26%)` | :arrow_down: |
   | [api/internal/handler/upstream/upstream.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdXBzdHJlYW0vdXBzdHJlYW0uZ28=) | `31.42% <0.00%> (-59.29%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `33.33% <0.00%> (-57.15%)` | :arrow_down: |
   | ... and [149 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [b54c195...836be0d](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* ready!
   
   Built with commit c66c9144f89e2353465089ea8e36b3e145378f18
   
   https://deploy-preview-1814--apisix-dashboard.netlify.app


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on a change in pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r625769191



##########
File path: api/cmd/managerapi.go
##########
@@ -65,6 +66,14 @@ func printVersion() {
 
 // NewManagerAPICommand creates the manager-api command.
 func NewManagerAPICommand() *cobra.Command {
+	cobra.OnInitialize(func() {
+		var err error
+		service, err = createService()

Review comment:
       Wait, what!! that's not from this PR 🤔




-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* processing.
   
   Building with commit c66c9144f89e2353465089ea8e36b3e145378f18
   
   https://app.netlify.com/sites/apisix-dashboard/deploys/6091539bbdb39c00078a4735


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-829942244


   Ou Nice!! It seems no stalling CI from node build. Thank you both :)


-- 
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.

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



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-833187903


   Hi @bisakhmondal, there have some errors in Backend CI.


-- 
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.

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



[GitHub] [apisix-dashboard] nic-chen commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-824527439


   I can't think of why. This should be the same as other new PRs, but other PRs have no such problem. Just wait for the reply from GitHub Support..


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-836538380


   Hi guys, the CI hadn't passed in this PR. Some checking was left to be done from my side. 
   
   I truly am sorry, I got caught up in university exams for a few days. I think we should revert the commit. CI has failed in the master too.
   
   https://github.com/apache/apisix-dashboard/pull/1814#discussion_r627478821
   Also this need to be taken care of.
   
   Sorry for the inconvenience. I am updating the PR as soon as possible. Thank you. 


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-829940642


   Thanks!! Done.


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* ready!
   
   Built with commit 836be0db343f75aa05d10723b1e608b023e89e27
   
   https://deploy-preview-1814--apisix-dashboard.netlify.app


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* ready!
   
   Built with commit b9aea519541a3fce74f747b2e1b2b0e75deee681
   
   https://deploy-preview-1814--apisix-dashboard.netlify.app


-- 
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.

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



[GitHub] [apisix-dashboard] nic-chen commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-829867274


   hi @bisakhmondal  please sync code from branch master


-- 
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.

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



[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r627474268



##########
File path: api/internal/utils/pid.go
##########
@@ -26,6 +26,9 @@ import (
 
 // WritePID write pid to the given file path.
 func WritePID(filepath string) error {
+	if _, err := os.Stat(filepath); err == nil {
+		return fmt.Errorf("instance of Manager API already running: a pid file exists in %s", filepath)

Review comment:
       Does this mean the manager can't start successfully if there exists a PID file?




-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-827306671


   Hii, any update :) 
   


-- 
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.

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



[GitHub] [apisix-dashboard] tokers commented on a change in pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r627478821



##########
File path: api/internal/utils/pid.go
##########
@@ -26,6 +26,9 @@ import (
 
 // WritePID write pid to the given file path.
 func WritePID(filepath string) error {
+	if _, err := os.Stat(filepath); err == nil {
+		return fmt.Errorf("instance of Manager API already running: a pid file exists in %s", filepath)

Review comment:
       We may add an option to start forcely.




-- 
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-824068065


   Hi, I just sent an email to GitHub Support, to ask for their help about this case.


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-833320046


   > Hi @bisakhmondal, there have some errors in Backend CI.
   
   Yeshh!! Sad moments🥺
   Looking into it :)


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* processing.
   
   Building with commit 836be0db343f75aa05d10723b1e608b023e89e27
   
   https://app.netlify.com/sites/apisix-dashboard/deploys/608bc293ba01880007ff0682


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-836596045


   > @bisakhmondal Hi, if it's ok, could you please send a new PR to fix that failure?
   
   Ya, that sounds awesome.
   
   but yet, I can't reproduce the failure(totally irrelevant to this PR) locally even with the same environment like CI inside a docker container,
   ![image](https://user-images.githubusercontent.com/41498427/117651395-8729f880-b1af-11eb-8810-2d3133d975c8.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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* ready!
   
   Built with commit d12924a33a782c51723e30aa3fa0fff17cfd6d5b
   
   https://deploy-preview-1814--apisix-dashboard.netlify.app


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-836598386


   > @bisakhmondal Hi, if it's ok, could you please send a new PR to fix that failure?
   
   @juzhiyuan It seems to be a CI glitch, now the master is fine after a recent commit.
   ![image](https://user-images.githubusercontent.com/41498427/117654561-86936100-b1b3-11eb-9f74-3681d6ddc671.png)
   
   
   Even the last commit has passed all CI. What do you think, can we ignore?


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823984150


   @nic-chen still same issue. any idea why? this time I pull the master, created a new branch and handpicked the new lines (as the number of lines were less) of commit instead of cherry-picking to avoid this CI invocation, but still the same problem


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* ready!
   
   Built with commit 84e18e6da94fbd9aff6ddfa0ff6f46a52f6c0ef2
   
   https://deploy-preview-1814--apisix-dashboard.netlify.app


-- 
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-833187903


   Hi @bisakhmondal, it seems that there have some errors in Backend CI.


-- 
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.

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



[GitHub] [apisix-dashboard] codecov-commenter edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-829943690


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1814](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (836be0d) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/b54c19508e6265775069adee467acbc181b0acaf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b54c195) will **decrease** coverage by `9.59%`.
   > The diff coverage is `53.84%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1814      +/-   ##
   ==========================================
   - Coverage   71.45%   61.85%   -9.60%     
   ==========================================
     Files         172       47     -125     
     Lines        6121     3183    -2938     
     Branches      711        0     -711     
   ==========================================
   - Hits         4374     1969    -2405     
   + Misses       1498      898     -600     
   - Partials      249      316      +67     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `46.27% <53.84%> (+0.25%)` | :arrow_up: |
   | backend-e2e-test-ginkgo | `48.97% <53.84%> (+0.25%)` | :arrow_up: |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `58.33% <0.00%> (-27.90%)` | :arrow_down: |
   | [api/cmd/managerapi.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2NtZC9tYW5hZ2VyYXBpLmdv) | `48.95% <70.00%> (+0.60%)` | :arrow_up: |
   | [api/internal/utils/runtime/runtime.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL3V0aWxzL3J1bnRpbWUvcnVudGltZS5nbw==) | `0.00% <0.00%> (-64.29%)` | :arrow_down: |
   | [api/internal/core/store/validate\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGVfbW9jay5nbw==) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/filter/authentication.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2ZpbHRlci9hdXRoZW50aWNhdGlvbi5nbw==) | `47.22% <0.00%> (-30.56%)` | :arrow_down: |
   | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `66.08% <0.00%> (-26.09%)` | :arrow_down: |
   | [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | `64.51% <0.00%> (-19.36%)` | :arrow_down: |
   | [...pi/internal/handler/plugin\_config/plugin\_config.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcGx1Z2luX2NvbmZpZy9wbHVnaW5fY29uZmlnLmdv) | `59.57% <0.00%> (-18.09%)` | :arrow_down: |
   | [api/internal/filter/ip\_filter.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2ZpbHRlci9pcF9maWx0ZXIuZ28=) | `56.09% <0.00%> (-17.08%)` | :arrow_down: |
   | ... and [141 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1814/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [b54c195...836be0d](https://codecov.io/gh/apache/apisix-dashboard/pull/1814?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on a change in pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r627484178



##########
File path: api/internal/utils/pid.go
##########
@@ -26,6 +26,9 @@ import (
 
 // WritePID write pid to the given file path.
 func WritePID(filepath string) error {
+	if _, err := os.Stat(filepath); err == nil {
+		return fmt.Errorf("instance of Manager API already running: a pid file exists in %s", filepath)

Review comment:
       Hii guys, as we are now supporting manager-api as an os service, the PID file should not be overwritten unknowingly, because then `./manager-api stop` won't work. we have to take help from the os service manager explicitly.
   
   > We may add an option to start forcely.
   
   Yes, we can do that.




-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-824135228


   Nice🔥


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* processing.
   
   Building with commit b9aea519541a3fce74f747b2e1b2b0e75deee681
   
   https://app.netlify.com/sites/apisix-dashboard/deploys/608bd7f9fe2205000896173a


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-832015165


   Any idea why the upstream test suite is breaking🤔, the PR doesn't touch anything on that segment and moreover, it's HTTP 400!!
   
   All starts with `test upstream delete [It] create upstream without plugin ` i.e failing to process upstream request and rest (other tests) is dominos effect.
   
   But it's working fine locally
   ![Screenshot from 2021-05-04 20-09-42](https://user-images.githubusercontent.com/41498427/117025074-34b48c00-ad18-11eb-8c47-eb4700a7e161.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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-837618503


   I have to say it's unstable, please create an issue to track this :)


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* processing.
   
   Building with commit 84e18e6da94fbd9aff6ddfa0ff6f46a52f6c0ef2
   
   https://app.netlify.com/sites/apisix-dashboard/deploys/609155ddf16b980008212223


-- 
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1814: fix: efficient error handling in manager-api including graceful shutdown, self contained methods.

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-836564304


   @bisakhmondal Hi, if it's ok, could you please send a new PR to fix that failure?


-- 
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.

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



[GitHub] [apisix-dashboard] netlify[bot] commented on pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
netlify[bot] commented on pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#issuecomment-823982455


   Deploy preview for *apisix-dashboard* processing.
   
   Building with commit d12924a33a782c51723e30aa3fa0fff17cfd6d5b
   
   https://app.netlify.com/sites/apisix-dashboard/deploys/608009ed871db70008cf2c0a


-- 
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.

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



[GitHub] [apisix-dashboard] bisakhmondal commented on a change in pull request #1814: fix: store init error from etcd and deferred execution of closers

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #1814:
URL: https://github.com/apache/apisix-dashboard/pull/1814#discussion_r625604849



##########
File path: api/cmd/managerapi.go
##########
@@ -65,6 +66,14 @@ func printVersion() {
 
 // NewManagerAPICommand creates the manager-api command.
 func NewManagerAPICommand() *cobra.Command {
+	cobra.OnInitialize(func() {
+		var err error
+		service, err = createService()

Review comment:
       Hi @tokers, I'm afraid that's not possible here due to variable shadowing.
   
   `service` is a global variable and assignment through go's short assignment operator (`:=`) will create a brand new `service` var in this scope without referencing the global one.
   
   I looked into the docs and also cross-checked [ref](https://golang.org/ref/spec#Declarations_and_scope)
   >An identifier declared in a block may be redeclared in an inner block. While the identifier of the inner declaration is in scope, it denotes the entity declared by the inner declaration.
   
   Anyway, Thank you. Got the scope to re-read the docs :)
   




-- 
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.

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