che icon indicating copy to clipboard operation
che copied to clipboard

Che machine exec fails to start if the devfile has a post start event (Che-Code is the editor)

Open l0rd opened this issue 2 years ago • 11 comments

Describe the bug

Previously it was possible to select in which container we could open a terminal.

But this option is not available anymore:

image

Che version

next (development version)

Steps to reproduce

Start a workspace using Che-Code as the editor and open the command palette to create a terminal.

Expected behavior

Che-code should propose to create the terminal in one of the devfile containers.

In that list the containers that are not in the devfile (gateway, telemetry etc...) should not appear.

The default container should be the container where Che-Code runs.

Runtime

Dogfooding instance

l0rd avatar May 30 '22 09:05 l0rd

you've this option using With Profile

image

benoitf avatar May 30 '22 09:05 benoitf

Thanks @benoitf but I cannot see the dropdown list in my case: image

l0rd avatar May 30 '22 15:05 l0rd

I've tested on the dogfooding instance using https://che-dogfooding.apps.che-dev.x6e0.p1.openshiftapps.com/#https://github.com/che-samples/java-spring-petclinic/tree/devfilev2?che-editor=che-incubator/che-code/insiders

do you have more than one container/component in your devfile ?

benoitf avatar May 30 '22 15:05 benoitf

Yes, I have more than one container. I am testing with https://che-dogfooding.apps.che-dev.x6e0.p1.openshiftapps.com/#https://github.com/l0rd/microservices-demo-frontend

l0rd avatar May 30 '22 15:05 l0rd

is it always the case or randomly ? b/c I have the terminal options with your sample

https://user-images.githubusercontent.com/436777/171030118-399c84eb-2a14-4b93-be7c-6304e3853ff6.mp4

what is the log of container using che-code ?

benoitf avatar May 30 '22 16:05 benoitf

It's systematic. This is the container log:

total 4
drwxrwsrwx. 5 root user   97 May 30 15:43 .
dr-xr-xr-x. 1 root root  131 May 30 15:44 ..
drwxr-sr-x. 2 user user   26 May 30 15:43 bin
drwxr-sr-x. 7 user user  135 May 30 15:43 checode-linux-libc
drwxr-sr-x. 7 user user  135 May 30 15:43 checode-linux-musl
-rwxr-xr-x. 1 user user 1355 May 30 15:43 entrypoint-volume.sh
time="2022-05-30T15:44:02Z" level=info msg="Default 'info' log level is applied"
time="2022-05-30T15:44:02Z" level=info msg="Exec containers configuration:"
time="2022-05-30T15:44:02Z" level=info msg="==> Debug level info"
time="2022-05-30T15:44:02Z" level=info msg="==> Application url 0.0.0.0:3333"
time="2022-05-30T15:44:02Z" level=info msg="==> Absolute path to folder with static resources "
time="2022-05-30T15:44:02Z" level=info msg="==> Use bearer token: false"
time="2022-05-30T15:44:02Z" level=info msg="==> Pod selector: controller.devfile.io/devworkspace_id=workspaceb5cb54ab51114fa5"
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:	export GIN_MODE=release
 - using code:	gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /connect                  --> main.main.func2 (3 handlers)
[GIN-debug] GET    /attach/:id               --> main.main.func3 (3 handlers)
[GIN-debug] POST   /exec/config              --> main.main.func4 (3 handlers)
[GIN-debug] POST   /exec/init                --> main.main.func5 (3 handlers)
[GIN-debug] POST   /activity/tick            --> main.main.func6 (3 handlers)
[GIN-debug] GET    /healthz                  --> main.main.func7 (3 handlers)
⇩ Registered RPCRoutes:

Json-rpc MachineExec Routes:
✓ create
✓ check
✓ resize
✓ listContainers
[GIN-debug] Listening and serving HTTP on 0.0.0.0:3333
Server bound to 127.0.0.1:3100 (IPv4)
Extension host agent listening on 3100

Web UI available at http://localhost:3100/
[15:44:07] Extension host agent started.
[GIN] 2022/05/30 - 15:44:07 | 200 |    1.336894ms |       127.0.0.1 | GET      /connect
Unable to parse result TypeError: Cannot read properties of undefined (reading 'map')
    at WebSocket.<anonymous> (/checode/checode-linux-libc/out/vs/server/node/server.main.js:135:105773)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (/checode/checode-linux-libc/node_modules/ws/lib/websocket.js:1022:20)
    at Receiver.emit (node:events:390:28)
    at Receiver.dataMessage (/checode/checode-linux-libc/node_modules/ws/lib/receiver.js:522:14)
    at Receiver.getData (/checode/checode-linux-libc/node_modules/ws/lib/receiver.js:440:17)
    at Receiver.startLoop (/checode/checode-linux-libc/node_modules/ws/lib/receiver.js:148:22)
    at Receiver._write (/checode/checode-linux-libc/node_modules/ws/lib/receiver.js:83:10)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Receiver.Writable.write (node:internal/streams/writable:334:10)
    at Socket.socketOnData (/checode/checode-linux-libc/node_modules/ws/lib/websocket.js:1116:35)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:199:23)
[15:44:16] [127.0.0.1][e358917c][ManagementConnection] New connection established.
[15:44:17] [127.0.0.1][1292f89e][ExtensionHostConnection] New connection established.
[15:44:17] [127.0.0.1][1292f89e][ExtensionHostConnection] <117> Launched Extension Host Process.
[15:44:17] RemoteTerminalChannel: unsupported command/$getTerminalLayoutInfo
[15:44:17] RemoteTerminalChannel: unsupported command/$reduceConnectionGraceTime
[15:44:20] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:44:20] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:44:21] [127.0.0.1][e358917c][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[15:44:21] [127.0.0.1][1292f89e][ExtensionHostConnection] <117> Extension Host Process exited with code: 0, signal: null.
[15:44:22] [127.0.0.1][45b2f3b1][ManagementConnection] New connection established.
[15:44:22] RemoteTerminalChannel: unsupported command/$getTerminalLayoutInfo
[15:44:22] [127.0.0.1][74e26b94][ExtensionHostConnection] New connection established.
[15:44:22] [127.0.0.1][74e26b94][ExtensionHostConnection] <130> Launched Extension Host Process.
[15:44:22] RemoteTerminalChannel: unsupported command/$reduceConnectionGraceTime
[15:44:24] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:44:24] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:44:26] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:44:28] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:44:28] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:44:28] RemoteTerminalChannel: unsupported command/$getEnvironment
time="2022-05-30T15:44:28Z" level=error msg="Unable to initialize terminal. Cause: container with name Terminal was not found."
[GIN] 2022/05/30 - 15:44:28 | 200 |      48.321µs |       127.0.0.1 | GET      /attach/undefined
[15:44:28] Error: Unexpected server response: 200
    at ClientRequest.<anonymous> (/checode/checode-linux-libc/node_modules/ws/lib/websocket.js:753:7)
    at ClientRequest.emit (node:events:390:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:623:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at Socket.socketOnData (node:_http_client:487:22)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:199:23)
[15:44:28] RemoteTerminalChannel: unsupported command/$resize

l0rd avatar May 30 '22 16:05 l0rd

Ok could you try to find machine exec process, kill it and restart it ( with the same options) Get it using ps auxwwww

benoitf avatar May 30 '22 16:05 benoitf

I confirm that restarting machine exec fixes the problem.

l0rd avatar May 30 '22 17:05 l0rd

I confirm that if I remove the postStart event everything works fine 😲

l0rd avatar Jun 02 '22 13:06 l0rd

ok I don't know how it's affecting the process :-/ but at least there is one clue about it

benoitf avatar Jun 02 '22 14:06 benoitf

Thanks to this comment https://github.com/devfile/devworkspace-operator/pull/659#pullrequestreview-791673736 I noticed that I don't get this issue if the postStart command is a background command like yarn install & instead of yarn install

dkwon17 avatar Aug 24 '22 21:08 dkwon17

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.

che-bot avatar Feb 20 '23 00:02 che-bot

I am not reproducing this issue anymore

l0rd avatar Feb 20 '23 06:02 l0rd