eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.98k stars 1.19k forks source link

Post start commands should be run detached #22081

Open l0rd opened 1 year ago

l0rd commented 1 year ago

Is your enhancement related to a problem? Please describe

Workspaces Pod is stuck in PodInitializing status until postStart command doesn't complete.

This can be tested with the devfile in this repository where the postStart command is tail -f /dev/null and the workspaces never starts:

schemaVersion: 2.2.0
(...)
commands:
(...)
  - id: neverendingcommand
    exec:
      label: "8. Tail /dev/null"
      component: tools
      commandLine: |
        tail -f /dev/null
      group:
        kind: build
events:
  postStart:
    - neverendingcommand
image

Describe the solution you'd like

A postStart event should never block the workspace startup. The command should run detached. One way to do that would be to prefix the command with nohup and suffix it with &:

A command in a devfile or devworkspace should then be transformed into a container lifecycle postStart like the following one:

      lifecycle:
        postStart:
          exec:
            command:
              - 'nohup'
              - 'tail'
              - '-f'
              - '/dev/null'
              - '&'
amisevsk commented 1 year ago

DWO PR https://github.com/devfile/devworkspace-operator/pull/1081 updates how postStart events are handled. However, it does not run all commands detached, as there is more risk of breaking commands if they are run in this way. Detaching all commands would mean that the container could be started before required commands complete.

l0rd commented 1 year ago

Detaching all commands would mean that the container could be started before required commands complete.

@amisevsk what scenario do you have in mind? Because the scenario I have in mind is when post start is used to run mvn package (or any command to build / test / run the application) and the IDE startup should not be blocked by that. But I am afraid I am missing some important scenario where it makes sense for the container to be started after.

amisevsk commented 1 year ago

I don't have a specific example in mind -- my main concerns are

We can continue to look into it, but I feel like the risks potentially outweigh the gains.

l0rd commented 1 year ago

Ok let's put that on hold for now and wait to see if there is any user/customer complain.

che-bot commented 8 months ago

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

amisevsk commented 8 months ago

/remove-lifecycle stale