easegress-io / easegress

A Cloud Native traffic orchestration system
https://megaease.com/easegress/
Apache License 2.0
5.78k stars 500 forks source link

signal-upgrade close of closed channel #1190

Closed suchen-sci closed 9 months ago

suchen-sci commented 10 months ago

As discussed in issue #1170 , when use signal-upgrade to graceful update easegress, it will cause a panic with message "close of closed channel". Although it not influence the usage of easegress, but we'd better to fix it.

After some carefully digging, here is what happens. When use signal-upgrade, easegress-server receive a user signal, then graceful upgrade. What happens here is easegress-server gracefully closes api-server and starts a new process (like fork, start a new process with original environment and configuration). And when the new process is started, it will send a signal to old process to terminate, which will close the api-server again, cause the panic with message "close of closed channel". Because both two close of api-server happens in original process, it won't influence the new process.

But since this may influence the core part of easegress. Any fix with a lot of code change may cause potential bugs. So, in this pr, I fix it by making api-server recloseable.

codecov-commenter commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (b5f08e1) 80.84% compared to head (1453bbf) 79.75%. Report is 3 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1190 +/- ## ========================================== - Coverage 80.84% 79.75% -1.10% ========================================== Files 149 153 +4 Lines 17042 17402 +360 ========================================== + Hits 13778 13879 +101 - Misses 2597 2852 +255 - Partials 667 671 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.