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

che-code terminal won't start #21081

Closed
nils-mosbach opened this issue Jan 27, 2022 · 14 comments
Closed

che-code terminal won't start #21081

nils-mosbach opened this issue Jan 27, 2022 · 14 comments
Labels
area/editor/vscode Issues related to the Code OSS editor of Che kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.

Comments

@nils-mosbach
Copy link

nils-mosbach commented Jan 27, 2022

Describe the bug

The current version of che-code has issues establishing a terminal session in our case.

image

I'm not sure if that helps, but default terminal is null in the settings.

image

I know che-code is currently under active devlopment, so feel free to close the issue if this was something that is already known, or work in progress.

@benoitf We'll start migrating our exisiting theia environment to che-code and do some testing. Since you're currently working on this, should I summarize things that pop up in the epic (#20500), create tickets or just wait and test again after the next release? Che-Code is going to be a huge step forward. Thanks a lot for your effort!

Che version

next (development version)

Steps to reproduce

Open a terminal window in che-code.

Expected behavior

Bash should open.

Runtime

Kubernetes (vanilla)

Screenshots

No response

Installation method

chectl/next

Environment

Linux

Eclipse Che Logs

Chrome browser logs:

Creating workbench with config  {
  "folderUri": {
    "$mid": 1,
    "path": "/projects/devfile-test",
    "scheme": "vscode-remote",
    "authority": "company.dev"
  },
  "remoteAuthority": "company.dev",
  "developmentOptions": {},
  "workspaceProvider": {
    "workspace": {
      "folderUri": {
        "$mid": 1,
        "path": "/projects/devfile-test",
        "scheme": "vscode-remote",
        "authority": "company.dev"
      }
    },
    "payload": {},
    "trusted": true
  },
  "urlCallbackProvider": {
    "_store": {
      "_toDispose": {},
      "_isDisposed": false
    },
    "_onCallback": {
      "_disposed": false
    }
  },
  "credentialsProvider": {}
}
workbench.web.api.js:576   ERR Could not resolve shell TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (workbench.web.api.js:1272:30826)
    at k._resolveVariables (workbench.web.api.js:1728:72047)
    at k._resolveProfile (workbench.web.api.js:1728:71781)
    at async k._refreshDefaultProfileName (workbench.web.api.js:1728:66983)
workbench.web.api.js:576   ERR Cannot convert undefined or null to object: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1272:30826)
    at https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1217:11364
    at https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1211:1014
    at Array.forEach (<anonymous>)
    at https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1211:992
    at Map.forEach (<anonymous>)
    at _.applyToProcessEnvironment (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1211:931)
    at D._resolveEnvironment (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1731:17830)
workbench.web.api.js:576   ERR Could not resolve shell TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (workbench.web.api.js:1272:30826)
    at k._resolveVariables (workbench.web.api.js:1728:72047)
    at k._resolveProfile (workbench.web.api.js:1728:71781)
    at async Promise.all (/workspace419b6e75649a4bc9/nodejsdev/3100/index 0)
    at async r._updateDefaultProfile (workbench.web.api.js:1728:47167)
workbench.web.api.js:576   ERR Could not resolve shell TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (workbench.web.api.js:1272:30826)
    at k._resolveVariables (workbench.web.api.js:1728:72047)
    at k._resolveProfile (workbench.web.api.js:1728:71781)
    at async Promise.all (/workspace419b6e75649a4bc9/nodejsdev/3100/index 1)
    at async r._updateDefaultProfile (workbench.web.api.js:1728:47167)
workbench.web.api.js:576   ERR Could not resolve shell TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (workbench.web.api.js:1272:30826)
    at k._resolveVariables (workbench.web.api.js:1728:72047)
    at k._resolveProfile (workbench.web.api.js:1728:71781)
    at async Promise.all (/workspace419b6e75649a4bc9/nodejsdev/3100/index 0)
    at async r._updateDefaultProfile (workbench.web.api.js:1728:47167)
workbench.web.api.js:576   ERR Could not resolve shell TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (workbench.web.api.js:1272:30826)
    at k._resolveVariables (workbench.web.api.js:1728:72047)
    at k._resolveProfile (workbench.web.api.js:1728:71781)
    at async Promise.all (/workspace419b6e75649a4bc9/nodejsdev/3100/index 1)
    at async r._updateDefaultProfile (workbench.web.api.js:1728:47167)
workbench.web.api.js:576   ERR Could not resolve shell TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (workbench.web.api.js:1272:30826)
    at k._resolveVariables (workbench.web.api.js:1728:72047)
    at k._resolveProfile (workbench.web.api.js:1728:71781)
    at async k._refreshDefaultProfileName (workbench.web.api.js:1728:66983)
workbench.web.api.js:576   ERR Cannot convert undefined or null to object: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at d.prepareEnv (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1272:30705)
    at d.resolveWithEnvironment (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1272:30826)
    at https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1217:11364
    at https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1211:1014
    at Array.forEach (<anonymous>)
    at https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1211:992
    at Map.forEach (<anonymous>)
    at _.applyToProcessEnvironment (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1211:931)
    at D._resolveEnvironment (https://company.dev/workspace419b6e75649a4bc9/nodejsdev/3100/static/out/vs/workbench/workbench.web.api.js:1731:17830)

Container logs

[15:02:16] [::ffff:127.0.0.1][3a3cd61d][ManagementConnection] New connection established.
[15:02:16] [::ffff:127.0.0.1][78913f72][ExtensionHostConnection] New connection established.
[15:02:16] [::ffff:127.0.0.1][78913f72][ExtensionHostConnection] <129> Launched Extension Host Process.
[15:02:16] RemoteTerminalChannel: unsupported command/$installAutoReply
[15:02:16] RemoteTerminalChannel: unsupported command/$getTerminalLayoutInfo
[15:02:16] RemoteTerminalChannel: unsupported command/$reduceConnectionGraceTime
[15:02:16] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:16] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:17] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:17] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:02:18] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:18] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:18] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:21] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:02:21] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:21] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:23] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:02:26] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:02:31] [::ffff:127.0.0.1][3a3cd61d][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[15:02:31] [::ffff:127.0.0.1][78913f72][ExtensionHostConnection] <129> Extension Host Process exited with code: 0, signal: null.
[15:02:31] [::ffff:127.0.0.1][e079cfc2][ManagementConnection] New connection established.
[15:02:32] [::ffff:127.0.0.1][b51a97e1][ExtensionHostConnection] New connection established.
[15:02:32] [::ffff:127.0.0.1][b51a97e1][ExtensionHostConnection] <167> Launched Extension Host Process.
[15:02:32] RemoteTerminalChannel: unsupported command/$installAutoReply
[15:02:32] RemoteTerminalChannel: unsupported command/$getTerminalLayoutInfo
[15:02:32] RemoteTerminalChannel: unsupported command/$reduceConnectionGraceTime
[15:02:32] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:32] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:32] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:32] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:02:34] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:34] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:34] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:34] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:34] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:37] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:37] RemoteTerminalChannel: unsupported command/$getEnvironment
[15:02:37] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo
[15:05:03] RemoteTerminalChannel: unsupported command/$setTerminalLayoutInfo

Additional context

No response

@nils-mosbach nils-mosbach added the kind/bug Outline of a bug - must adhere to the bug report template. label Jan 27, 2022
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Jan 27, 2022
@azatsarynnyy azatsarynnyy added area/editor/vscode Issues related to the Code OSS editor of Che team/editors status/analyzing An issue has been proposed and it is currently being analyzed for effort and implementation approach severity/P1 Has a major impact to usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Jan 27, 2022
@azatsarynnyy
Copy link
Member

I also have null set for the Default Profile setting:

image

But the Terminal works well:

image

Most likely, the problem is not related to the Default Profile setting.

@azatsarynnyy
Copy link
Member

I was able to reproduce the same terminal state after stopping my Che Workspace:

image

@azatsarynnyy
Copy link
Member

@nils-mosbach could you please check if your Workspace is still running when you try to open a terminal

@nils-mosbach
Copy link
Author

It is. Pod is running and I can open a terminal session and execute commands using kubectrl.

@benoitf
Copy link
Contributor

benoitf commented Jan 28, 2022

Hello @nils-mosbach ,

I don't know why I miss yesterday's notification
About

@benoitf We'll start migrating our exisiting theia environment to che-code and do some testing. Since you're currently working on this, should I summarize things that pop up in the epic (#20500), create tickets or just wait and test again after the next release? Che-Code is going to be a huge step forward. Thanks a lot for your effort!

I think creating separate issues is the way to go and I also like the fact that you report problem. Feedback is always welcome

About the issue itself, looking at the code, it seems we're in this part of the code

https://github.com/che-incubator/che-code/blob/7dc338e79032a0fccab3d854aed99164916f398d/code/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts#L374-L380

then

https://github.com/che-incubator/che-code/blob/7dc338e79032a0fccab3d854aed99164916f398d/code/src/vs/workbench/services/configurationResolver/common/variableResolver.ts#L65-L67

and here the most important part:
https://github.com/che-incubator/che-code/blob/7dc338e79032a0fccab3d854aed99164916f398d/code/src/vs/workbench/services/configurationResolver/common/variableResolver.ts#L53-L62

Could you confirm you're using Windows ? it might explain while I have not seen the issue as I'm not using it.

Then in order to fix the issue, it means that probably we have some invalid envVariables objects

so it might be interesting to look at env variables in the code's container

@nils-mosbach
Copy link
Author

@benoitf No worries, will do. Yes, I'm using Microsoft Edge on Windows. Workspace I've used was https://github.com/che-incubator/che-code.git. Debugging client code is a little messy, since Edge debugger tries to get ts-files from /projects/.../ which does not work on my windows host machine. Anyway, I tried to get a little bit more on what's happening in the code using the compiled sources.

https://github.com/che-incubator/che-code/blob/7dc338e79032a0fccab3d854aed99164916f398d/code/src/vs/workbench/services/configurationResolver/common/variableResolver.ts#L65-L67

// resolveWithEnvironment executed with
// environment: undefined
// root: {
//     "uri": {
//         "$mid": 1,
//         "fsPath": "\\projects\\che-code",
//         "_sep": 1,
//         "external": "vscode-remote://company.dev/projects/che-code",
//         "path": "/projects/che-code",
//         "scheme": "vscode-remote",
//         "authority": "company.dev"
//     },
//     "name": "che-code",
//     "index": 0
// }
// value: "/bin/bash"
public resolveWithEnvironment(environment: IProcessEnvironment, root: IWorkspaceFolder | undefined, value: string): string {
    return this.recursiveResolve(this.prepareEnv(environment), root ? root.uri : undefined, value);
}

Seems that environment should not be empty. This function should fetch the environment:

https://github.com/che-incubator/che-code/blob/7dc338e79032a0fccab3d854aed99164916f398d/code/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts#L333

// _resolveProfile executed with
// profile: {
//     "profileName": "dev",
//     "path": "/bin/bash",
//     "isDefault": false,
//     "isAutoDetected": false,
//     "overrideName": true,
//     "color": "f00"
// }
// options: {
//     "remoteAuthority": "company.dev",
//     "os": 3
// }
// This call is hit multiple times. The second run `options.remoteAuthority` is undefined.
private async _resolveProfile(profile: ITerminalProfile, options: IShellLaunchConfigResolveOptions): Promise<ITerminalProfile> {
    if (options.os === OperatingSystem.Windows) { // DEBUGGING: options.os is Linux
        // ...
    }

    // this call seems to return undefined
    const env = await this._context.getEnvironment(options.remoteAuthority);
}

And container vars

Show environment variables
$ env
WORKSPACEC3372358005A4804_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACE1B13865DA27641B8_SERVICE_PORT_8000_TCP=tcp://10.43.97.102:8000
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_3030_TCP=tcp://10.43.228.178:3030
WORKSPACE0154D717376C4CAB_SERVICE_PORT_3030_TCP=tcp://10.43.202.33:3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3030_TCP=tcp://10.43.14.8:3030
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_4900_TCP_ADDR=10.43.251.164
WORKSPACE97BA732D231B4114_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE7D39209ADF524FB1_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE0154D717376C4CAB_SERVICE_SERVICE_HOST=10.43.202.33
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_4900_TCP_PORT=4900
WORKSPACE0154D717376C4CAB_SERVICE_PORT_3030_TCP_ADDR=10.43.202.33
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_3030_TCP_ADDR=10.43.5.64
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_3030_TCP_ADDR=10.43.228.178
WORKSPACEB6FEFEF93154489E_SERVICE_SERVICE_PORT_GRAFANA=4900
DEVWORKSPACE_CREATOR=
WORKSPACEC3372358005A4804_SERVICE_SERVICE_HOST=10.43.248.165
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_9090_TCP_PROTO=tcp
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_8000_TCP_ADDR=10.43.5.64
HOSTNAME=workspace9cbedf7f47be4083-7d8c78fc5f-pztc4
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3000_TCP_PROTO=tcp
WORKSPACE1B13865DA27641B8_SERVICE_PORT_3030_TCP_ADDR=10.43.97.102
WORKSPACE134F22B325B941D9_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_4900_TCP=tcp://10.43.14.8:4900
WORKSPACE4DBD4A40894B4A2F_SERVICE_SERVICE_PORT_GRAFANA=4900
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_4900_TCP_ADDR=10.43.14.8
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3000_TCP_ADDR=10.43.251.164
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_9090_TCP_ADDR=10.43.251.164
WORKSPACE3C242C42809D4E47_SERVICE_SERVICE_PORT_GRAFANA=4900
WORKSPACE1B13865DA27641B8_SERVICE_PORT=tcp://10.43.97.102:3030
WORKSPACE134F22B325B941D9_SERVICE_PORT=tcp://10.43.48.19:3030
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_3030_TCP=tcp://10.43.207.59:3030
DEVWORKSPACE_NAME=che-code-qcsu
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_8000_TCP_PORT=8000
WORKSPACE4DBD4A40894B4A2F_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE134F22B325B941D9_SERVICE_PORT_9090_TCP_PORT=9090
WORKSPACE3C242C42809D4E47_SERVICE_PORT_4900_TCP_PORT=4900
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3000_TCP=tcp://10.43.14.8:3000
WORKSPACEC3372358005A4804_SERVICE_SERVICE_PORT=3030
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_8000_TCP_PROTO=tcp
WORKSPACEB6FEFEF93154489E_SERVICE_SERVICE_PORT=3030
WORKSPACE7D39209ADF524FB1_SERVICE_SERVICE_PORT_DEV=8000
WORKSPACE0154D717376C4CAB_SERVICE_PORT_8000_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_PROTO=tcp
WORKSPACEDC0EC9EBA22644BC_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE134F22B325B941D9_SERVICE_PORT_9090_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3000_TCP_PORT=3000
KUBERNETES_PORT_443_TCP_ADDR=10.43.0.1
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_3030_TCP=tcp://10.43.5.64:3030
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_8000_TCP_PROTO=tcp
WORKSPACE1B13865DA27641B8_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3000_TCP_ADDR=10.43.14.8
WORKSPACE134F22B325B941D9_SERVICE_SERVICE_PORT_IX=9090
WORKSPACEB6FEFEF93154489E_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE0154D717376C4CAB_SERVICE_PORT=tcp://10.43.202.33:3030
WORKSPACE134F22B325B941D9_SERVICE_PORT_3030_TCP_ADDR=10.43.48.19
KUBERNETES_PORT=tcp://10.43.0.1:443
WORKSPACE4DBD4A40894B4A2F_SERVICE_SERVICE_PORT=3030
DEVWORKSPACE_METADATA=/devworkspace-metadata
WORKSPACE9CBEDF7F47BE4083_SERVICE_SERVICE_HOST=10.43.5.64
WORKSPACE9CBEDF7F47BE4083_SERVICE_SERVICE_PORT=3030
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3000_TCP=tcp://10.43.251.164:3000
WORKSPACE0154D717376C4CAB_SERVICE_SERVICE_PORT_DEV=8000
PWD=/projects
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT=tcp://10.43.5.64:3030
HOME=/home/che
WORKSPACE0154D717376C4CAB_SERVICE_PORT_8000_TCP_ADDR=10.43.202.33
WORKSPACE3C242C42809D4E47_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_9090_TCP_PORT=9090
WORKSPACEC3372358005A4804_SERVICE_PORT_3030_TCP_ADDR=10.43.248.165
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_3030_TCP_ADDR=10.43.207.59
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3030_TCP=tcp://10.43.251.164:3030
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3030_TCP_PORT=3030
KUBERNETES_SERVICE_PORT_HTTPS=443
DEVWORKSPACE_NAMESPACE=che-workspace-mn-company-com-zsobsb
WORKSPACE1B13865DA27641B8_SERVICE_PORT_8000_TCP_ADDR=10.43.97.102
KUBERNETES_PORT_443_TCP_PORT=443
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_8000_TCP=tcp://10.43.5.64:8000
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_3030_TCP_ADDR=10.43.110.89
WORKSPACE97BA732D231B4114_SERVICE_SERVICE_PORT=3030
WORKSPACE3C242C42809D4E47_SERVICE_SERVICE_PORT_NODEJS=3000
WORKSPACE4DBD4A40894B4A2F_SERVICE_SERVICE_PORT_NODEJS=3000
WORKSPACEC3372358005A4804_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE4DBD4A40894B4A2F_SERVICE_SERVICE_PORT_IX=9090
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_8000_TCP_ADDR=10.43.110.89
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_4900_TCP=tcp://10.43.207.59:4900
PROJECT_SOURCE=/projects/che-code
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACE0154D717376C4CAB_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_4900_TCP_PROTO=tcp
WORKSPACE0154D717376C4CAB_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_SERVICE_HOST=10.43.251.164
WORKSPACE1B13865DA27641B8_SERVICE_PORT_3030_TCP=tcp://10.43.97.102:3030
WORKSPACE134F22B325B941D9_SERVICE_PORT_9090_TCP=tcp://10.43.48.19:9090
WORKSPACE97BA732D231B4114_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_8000_TCP=tcp://10.43.228.178:8000
WORKSPACE97BA732D231B4114_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACE134F22B325B941D9_SERVICE_SERVICE_PORT=3030
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_4900_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://10.43.0.1:443
WORKSPACE7D39209ADF524FB1_SERVICE_SERVICE_HOST=10.43.110.89
WORKSPACEB6FEFEF93154489E_SERVICE_SERVICE_HOST=10.43.207.59
WORKSPACEDC0EC9EBA22644BC_SERVICE_SERVICE_PORT_DEV=8000
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_4900_TCP_PORT=4900
WORKSPACEC3372358005A4804_SERVICE_PORT_3030_TCP=tcp://10.43.248.165:3030
WORKSPACE134F22B325B941D9_SERVICE_SERVICE_HOST=10.43.48.19
WORKSPACE7D39209ADF524FB1_SERVICE_PORT=tcp://10.43.110.89:3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT=tcp://10.43.14.8:3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3000_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACEDC0EC9EBA22644BC_SERVICE_SERVICE_PORT=3030
WORKSPACEDC0EC9EBA22644BC_SERVICE_SERVICE_HOST=10.43.228.178
WORKSPACE134F22B325B941D9_SERVICE_PORT_3030_TCP=tcp://10.43.48.19:3030
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_8000_TCP=tcp://10.43.110.89:8000
WORKSPACE3C242C42809D4E47_SERVICE_SERVICE_HOST=10.43.14.8
TERM=xterm-256color
WORKSPACE1B13865DA27641B8_SERVICE_PORT_8000_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_4900_TCP=tcp://10.43.251.164:4900
WORKSPACE1B13865DA27641B8_SERVICE_SERVICE_PORT_DEV=8000
WORKSPACE97BA732D231B4114_SERVICE_SERVICE_HOST=10.43.81.21
WORKSPACEC3372358005A4804_SERVICE_PORT=tcp://10.43.248.165:3030
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3000_TCP_PORT=3000
WORKSPACE1B13865DA27641B8_SERVICE_SERVICE_PORT=3030
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_3030_TCP_ADDR=10.43.251.164
WORKSPACE1B13865DA27641B8_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE0154D717376C4CAB_SERVICE_PORT_8000_TCP_PORT=8000
SHLVL=3
WORKSPACE3C242C42809D4E47_SERVICE_SERVICE_PORT=3030
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE0154D717376C4CAB_SERVICE_PORT_3030_TCP_PORT=3030
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_4900_TCP_ADDR=10.43.207.59
WORKSPACE134F22B325B941D9_SERVICE_PORT_3030_TCP_PROTO=tcp
KUBERNETES_SERVICE_PORT=443
WORKSPACE1B13865DA27641B8_SERVICE_PORT_8000_TCP_PORT=8000
WORKSPACE134F22B325B941D9_SERVICE_PORT_9090_TCP_ADDR=10.43.48.19
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT=tcp://10.43.251.164:3030
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_8000_TCP_PROTO=tcp
WORKSPACE97BA732D231B4114_SERVICE_PORT_3030_TCP=tcp://10.43.81.21:3030
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT=tcp://10.43.228.178:3030
WORKSPACE1B13865DA27641B8_SERVICE_PORT_3030_TCP_PORT=3030
DEVWORKSPACE_FLATTENED_DEVFILE=/devworkspace-metadata/flattened.devworkspace.yaml
DEVWORKSPACE_ORIGINAL_DEVFILE=/devworkspace-metadata/original.devworkspace.yaml
WORKSPACE3C242C42809D4E47_SERVICE_PORT_3030_TCP_ADDR=10.43.14.8
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_8000_TCP_ADDR=10.43.228.178
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACEB6FEFEF93154489E_SERVICE_PORT=tcp://10.43.207.59:3030
PROJECTS_ROOT=/projects
WORKSPACE7D39209ADF524FB1_SERVICE_SERVICE_PORT=3030
WORKSPACE9CBEDF7F47BE4083_SERVICE_PORT_3030_TCP_PROTO=tcp
DEVWORKSPACE_ID=workspace9cbedf7f47be4083
WORKSPACE97BA732D231B4114_SERVICE_PORT_3030_TCP_ADDR=10.43.81.21
WORKSPACE134F22B325B941D9_SERVICE_PORT_3030_TCP_PORT=3030
PATH=/opt/nodejs/bin:/home/che/.npm-global/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NPM_CONFIG_PREFIX=/home/che/.npm-global
WORKSPACE0154D717376C4CAB_SERVICE_PORT_8000_TCP=tcp://10.43.202.33:8000
WORKSPACEDC0EC9EBA22644BC_SERVICE_PORT_8000_TCP_PORT=8000
DEVWORKSPACE_IDLE_TIMEOUT=15m
WORKSPACE9CBEDF7F47BE4083_SERVICE_SERVICE_PORT_WS_ROUTE=3030
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_8000_TCP_PORT=8000
KUBERNETES_SERVICE_HOST=10.43.0.1
WORKSPACEB6FEFEF93154489E_SERVICE_PORT_4900_TCP_PROTO=tcp
WORKSPACE97BA732D231B4114_SERVICE_PORT=tcp://10.43.81.21:3030
WORKSPACE1B13865DA27641B8_SERVICE_SERVICE_HOST=10.43.97.102
WORKSPACE7D39209ADF524FB1_SERVICE_PORT_3030_TCP=tcp://10.43.110.89:3030
WORKSPACE9CBEDF7F47BE4083_SERVICE_SERVICE_PORT_DEV=8000
DEVWORKSPACE_COMPONENT_NAME=dev
WORKSPACEC3372358005A4804_SERVICE_PORT_3030_TCP_PROTO=tcp
WORKSPACE4DBD4A40894B4A2F_SERVICE_PORT_9090_TCP=tcp://10.43.251.164:9090
WORKSPACE0154D717376C4CAB_SERVICE_SERVICE_PORT=3030
_=/usr/bin/env

@benoitf
Copy link
Contributor

benoitf commented Jan 28, 2022

ok I guess DEVWORKSPACE_CREATOR= might be an issue for the code

on my side it's not empty (so anyway we could exclude env var in the entrypoint that are empty to avoid failures on windows)

it's defined there
https://github.com/devfile/devworkspace-operator/blob/f7bdb41dd73b2b3adba994382d04d8d845dcd6b0/pkg/library/env/workspaceenv.go#L33

@nils-mosbach
Copy link
Author

nils-mosbach commented Jan 28, 2022

Seems that this wasn't causing the issue. I created a patch that doesn't set DEVWORKSPACE_CREATOR if its empty. There was another empty one _BUILDAH_STARTED_IN_USERNS which I overwrote in the devfile.

So after removing all empty envs, the error stays the same. I also tried setting a value for DEVWORKSPACE_CREATOR just in case...

@nils-mosbach
Copy link
Author

nils-mosbach commented Jan 28, 2022

You're right. It actually seems like checks for Windows pass in https://github.com/che-incubator/che-code/blob/7dc338e79032a0fccab3d854aed99164916f398d/code/src/vs/base/common/platform.ts#L77.

Object.keys(envVariables) / Object.keys(v) throws null if no environment and therefore no envvars are given.

image

Note sure if tricking vs code to linux is a good thing, or if a check would be better. I'll give the check a go, maybe that solves the issue.

private prepareEnv(envVariables: IProcessEnvironment): IProcessEnvironment {
		// windows env variables are case insensitive
		if (isWindows && envVariables) {
			const ev: IProcessEnvironment = Object.create(null);
			Object.keys(envVariables).forEach(key => {
				ev[key.toLowerCase()] = envVariables[key];
			});
			return ev;
		}
		return envVariables;
	}

@nils-mosbach
Copy link
Author

if (isWindows && envVariables) actually solves it. Nice!

@benoitf
Copy link
Contributor

benoitf commented Jan 28, 2022

thanks for your great analysis.

We're missing some methods in our terminal implementation #21080 and I suspect that getEnvironment is one of them

https://github.com/che-incubator/che-code/blob/1959bc362144e6c878c6bac59291b8ac7128fd9d/code/src/vs/server/node/remoteTerminalChannel.ts#L127

so we could add (before a better implementation) there
https://github.com/che-incubator/che-code/blob/1959bc362144e6c878c6bac59291b8ac7128fd9d/code/src/vs/server/node/che/remoteTerminalMachineExecChannel.ts#L103-L105

a new case to handle $getEnvironment

then instead of returning undefined https://github.com/che-incubator/che-code/blob/1959bc362144e6c878c6bac59291b8ac7128fd9d/code/src/vs/server/node/che/remoteTerminalMachineExecChannel.ts#L161

we could return an empty object {} until the proper implementation delegating to machine-exec

@nils-mosbach
Copy link
Author

@benoitf I've tested your recommended change and it solves the issue. Thanks! :) Submitted a PR.

@nils-mosbach
Copy link
Author

Checked with latest che-code insider build. Works. Closing the issue.

@benoitf benoitf removed the status/analyzing An issue has been proposed and it is currently being analyzed for effort and implementation approach label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/vscode Issues related to the Code OSS editor of Che kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

4 participants