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

[WIP] Resolve the PreStartHook failure caused by the slow startup of fuse container #4456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Syspretor
Copy link
Collaborator

Fixes #4455
The following postStartHook will be injected in the fuse-sidecar to check the mount status.

lifecycle:
  postStart:
    exec:
      command: [ "/bin/sh", "-c", "time /check-mount.sh >> /proc/1/fd/1" ]

However, the startup of the Container and the execution of the PostStartHook occur in parallel. it is possible that when the PostStartHook is executed, the PID 1 process inside the container has not completed its startup. This can lead to a failure in redirecting to /proc/1/fd/1 when the PostStartHook runs the check-mount script.

Copy link

fluid-e2e-bot bot commented Dec 23, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ronggu for approval by writing /assign @ronggu in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Syspretor Syspretor requested a review from cheyang December 23, 2024 11:46
@@ -105,7 +105,8 @@ func (a *ScriptGeneratorForApp) getConfigmapName() string {
func (a *ScriptGeneratorForApp) GetPostStartCommand(mountPaths string, mountTypes string) (handler *corev1.LifecycleHandler) {
// Return non-null post start command only when PostStartInjeciton is enabled
// https://github.com/kubernetes/kubernetes/issues/25766
cmd := []string{"bash", "-c", fmt.Sprintf("time %s %s %s >> /proc/1/fd/1", appScriptPath, mountPaths, mountTypes)}
// https://github.com/fluid-cloudnative/fluid/issues/4455
cmd := []string{"bash", "-c", fmt.Sprintf("while [ ! -e /proc/1/fd/1 ]; do sleep 1; done; bash -c 'time %s %s %s >> /proc/1/fd/1'", appScriptPath, mountPaths, mountTypes)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest adding a timeout to avoid potential infinite loops in case of unexpected conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants