-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
skip setup signal notifier for detached container #4661
base: main
Are you sure you want to change the base?
skip setup signal notifier for detached container #4661
Conversation
9d4b664
to
08ab900
Compare
For detached container, we don't need to setup signal notifier, because there is no customer to consume the signals in `forward()`. Signed-off-by: lifubang <lifubang@acmcoder.com>
08ab900
to
b2d5924
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's weird. We set up signal forwarding (for create/run/exec) and then we don't use it.
But, if notifySocker is non-nil, we set up signal forwarding and when we do forward signals for some short time (until we exit).
I can't review it because the current code makes no sense to me :(
I don’t think so, if notifySocket is non-nil, we also don’t consume any signals. There are two places checking detach in ‘forward()’:
The signal consumer is in: Line 95 in b2d5924
If I miss something, please tell me. |
Ah, yes, you are right, if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (yet I wish someone can refactor the code dealing with notifySocket, it seems it is orthogonal to signals and yet it is mixed together)
There are two paths about `detach` because we need to setup notify socket once it is exist. It will cause the code too complex to read. So refactor it to keep one path for detached container. Signed-off-by: lifubang <lifubang@acmcoder.com>
Refactored. I think we should setup notify socket first before we handler and forward signals for non detached containers, so I didn't split them to two functions, but refactor to keep one path for detached container. |
For detached container, we don't need to setup signal notifier, because there is no customer to consume the signals in
forward()
.