Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal-upgrade close of closed channel #1190

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

suchen-sci
Copy link
Contributor

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
Copy link

codecov-commenter commented Jan 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -136,5 +139,7 @@ func (m *dynamicMux) reloadAPIs() {
}

func (m *dynamicMux) close() {
close(m.done)
m.closeOnce.Do(func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's rare to support reclosable in Easegress, so it's better to add a comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated! please check

@xxx7xxxx xxx7xxxx added this pull request to the merge queue Jan 15, 2024
Merged via the queue into easegress-io:main with commit db771f8 Jan 15, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants