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

[Bug]: terminal not opening on 4.9.0 on macOS (github release and homebrew) #5843

Closed
4 tasks done
jsjoeio opened this issue Dec 7, 2022 · 23 comments
Closed
4 tasks done
Assignees
Labels
bug Something isn't working high-priority This issue needs to be resolved ASAP
Milestone

Comments

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 7, 2022

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: macOS
  • Remote OS: macOS
  • Remote Architecture: n/a
  • code-server --version: 4.9.0

Steps to Reproduce

  1. brew upgrade code-server
  2. code-server
  3. open Integrated Terminal

Expected

The terminal should load

Actual

It doesn't load

Logs

  ERR TypeError: Cannot read properties of undefined (reading 'cell')
    at c.getFont (terminalConfigHelper.ts:188:73)
    at Ui.getFont (xtermTerminal.ts:416:29)
    at Ki._getDimension (terminalInstance.ts:698:40)
    at Ki._evaluateColsAndRows (terminalInstance.ts:649:26)
    at Ki.layout (terminalInstance.ts:1875:30)
    at Ki._open (terminalInstance.ts:1072:9)
    at Ki.setVisible (terminalInstance.ts:1350:9)
    at g.setInput (terminalEditor.ts:78:39)
    at async a.doSetInput (editorPanes.ts:353:4)
    at async a.doOpenEditor (editorPanes.ts:222:34)

Screenshot/Video

image

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

@jsjoeio jsjoeio added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Dec 7, 2022
@jsjoeio jsjoeio self-assigned this Dec 7, 2022
@jsjoeio jsjoeio removed the triage This issue needs to be triaged by a maintainer label Dec 7, 2022
@jsjoeio jsjoeio added this to the December 2022 milestone Dec 7, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

First thought is to test the macOS binary in the releases to see if this is specific to using code-server on Homebrew.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Confirmed also broken on macOS release.

image

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

However, it is working on Linux so that's good.

image

I'll check npm next.

@jsjoeio jsjoeio changed the title [Bug]: terminal not opening on 4.9.0 [Bug]: terminal not opening on 4.9.0 on macOS (release and homebrew) Dec 7, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

npm is also broken, which means anyone on AUR or Homebrew will also have a broken terminal

image

@jsjoeio jsjoeio added the high-priority This issue needs to be resolved ASAP label Dec 7, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Next step is to see if this happens locally on macOS when I develop code-server. That'll tell me if this is only for production builds.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Since I develop code-server with code-server and Homebrew doesn't maintain versions, I'll have to download via npm and downgrade to 4.8.3

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Hmm...terminal works just fine in development 🤔

image

So something must be up with the build process.

@jsjoeio jsjoeio changed the title [Bug]: terminal not opening on 4.9.0 on macOS (release and homebrew) [Bug]: terminal not opening on 4.9.0 on macOS (github release, homebrew and npm) Dec 7, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Next thing is to download the npm artifact that was used to create the release packages here: https://github.com/coder/code-server/actions/runs/3624825961

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Hmm...so that one works:

  1. download artifact
  2. unzip
  3. cd release && yarn
  4. node . --port 3002

image

To be clear this is the npm artifact after we modify the version 🤔 That could mean something during the macOS build and then also when we download the artifact before publishing to npm.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Next step is to try replicating the "publish to npm" steps by downloading the package.tar.gz from releases and testing locally.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Tried this:

  1. download package.tar.gz from 4.9.0 release
  2. unzip
  3. cd && yarn
  4. node . --port 3002

and it worked as expected

image

Very confused 🤔

@jsjoeio jsjoeio changed the title [Bug]: terminal not opening on 4.9.0 on macOS (github release, homebrew and npm) [Bug]: terminal not opening on 4.9.0 on macOS (github release and homebrew) Dec 7, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 7, 2022

Fixed via #5844

@jsjoeio jsjoeio closed this as completed Dec 7, 2022
@jsjoeio jsjoeio reopened this Dec 9, 2022
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

Still happening but i did notice that if i use yarn after downloading the github release for macOS, it works. We'll have to investigate further.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

We've been digging in for the last two days and here's a brief summary of what we know:

  • macos-amd64 seems to be affected but if you rm -rf node_modules and run yarn at the root and lib/vscode the terminal loads
  • we're not sure if this is caused by npm but it does seem like having native dependencies fixes the issue
  • we don't know if upgrading to 1.74 will fix it (as an alternative)
  • the npm / yarn situation is tricky and is hard to debug

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

Investigation Notes

Part of me thinks I should revert these changes and build a standalone release on my macOS and see if that works.

You think so?

Actually no, let's start from the beginning...You released 4.9.0 and you noticed it didn't work via Homebrew or macOS, right?

Exactly

Okay so let's start there. Do this:

  1. Download the macos-amd64 release from 4.9.0
  2. Unzip
  3. cd && ./bin/code-server --port 8080
  4. Open the Integrated Terminal

Then tell me what happens.

Terminal is broken

image

Cool. We expected that. Are there any logs in the browser console?

Yup. Let me post it.

log.ts:324   ERR Cannot read properties of undefined (reading 'cell'): TypeError: Cannot read properties of undefined (reading 'cell')
    at c.getFont (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:3249:11304)
    at Ui.getFont (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:2008:28624)
    at Ki._getDimension (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:3141:42090)
    at Ki._evaluateColsAndRows (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:3141:41197)
    at Ki.layout (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:3144:2577)
    at Ki._open (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:3141:50915)
    at Ki._createXterm (http://localhost:8080/stable-6261075646f055b99068d3688932416f2346dd3b/static/out/vs/workbench/workbench.web.main.js:3141:45717)

Nice. Okay I've seen that before. Did you check upstream to see if there's an issue about it?

Yes, I found this.

microsoft/vscode#161049

Nice! If you pay attention to the PR description for the fix though, see this:

Note that this doesn't fix the underling issue but can give us better exceptions thrown at the right place.

Makes me think it still could be unresolved 🤔

What next?

I was messing around and might know of a workaround. Can you do this:

  1. cd into that unzipped release you have locally
  2. rm -rf node_modules lib/vscode/node_modules
  3. yarn && cd lib/vscode && yarn
  4. ./bin/code-server --port 8080
  5. open integrated terminal

Still broken

Really?? I thought that might work. Okay can you try the same thing but download the macos-amd64 4.9.1 draft release I have?

Sure!

What happens?

So 4.9.1 has a broken terminal but let me try your node_modules trick.

Okay then report back.

Still broken.

yarn && cd lib/vscode && yarn
yarn install v1.22.18
warning npm-shrinkwrap.json found. This will not be updated or respected. See https://yarnpkg.com/en/docs/migrating-from-npm for more information.
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning " > @coder/[email protected]" has unmet peer dependency "@google-cloud/logging@^9.2.1".
[5/5] 🔨  Building fresh packages...
success Saved lockfile.
$ sh ./postinstall.sh
Installing Code dependencies...
User agent: yarn/1.22.18 npm/? node/v16.17.0 darwin x64
yarn install v1.22.18
warning npm-shrinkwrap.json found. This will not be updated or respected. See https://yarnpkg.com/en/docs/migrating-from-npm for more information.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "@microsoft/1ds-core-js > @microsoft/[email protected]" has unmet peer dependency "tslib@*".
[4/4] 🔨  Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.19", while you're on "1.22.18".
info To upgrade, run the following command:
$ brew upgrade yarn
✨  Done in 32.86s.
User agent: yarn/1.22.18 npm/? node/v16.17.0 darwin x64
yarn install v1.22.18
warning npm-shrinkwrap.json found. This will not be updated or respected. See https://yarnpkg.com/en/docs/migrating-from-npm for more information.
[1/4] 🔍  Resolving packages...
error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
You may not have the required dependencies to build the native modules.
Please see https://github.com/coder/code-server/blob/main/docs/npm.md
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Dang it. I thought that worked. Okay well I need a lunch break so we'll continue after this.

sounds good!

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

Idea after lunch break - double-check this issue doesn't exist in dev mode locally

if terminal does work, try copying node_modules into the 4.9.1 and seeing if that fixes it

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

Investigation - round 2

So when developing locally against main and running yarn watch it works 🤔

Interesting...Want to try copying those lib/vscode/node_modules into the 4.9.1's directory and see if that works?

Sure.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

Investigation - round 2

So when developing locally against main and running yarn watch it works 🤔

Interesting...Want to try copying those lib/vscode/node_modules into the 4.9.1's directory and see if that works?

Woah! That worked!

Interesting...so that seems to be a modules issue at the lib/vscode level 🤔 One thing too is you're using yarn with yarn watch so...

so now what?

We're going to try something funky. Take broken node_modules aka some from 4.9.0 lib/vscode and copy on top of lib/vscode/node_modules in your dev build locally. Then it will only try to replace ones that conflict.

interesting...okay

One other thing we noticed was there was some caching of the modules in the browser so when i got it working but then went to Incognito it stopped.

what next?

Copy the lib/vscode/node_modules/xterm-* modules into lib/vscode/remote/web/node_modules and see if it breaks as expected.

it worked meaning it is still broken

image

what next?

I have to run, but try replacing each "back-up-xterm" module back into your local lib/vscode/remote/web/node_modules one by one and refresh the page each time to see if you can isolate which package is messed up (because we checked package.json and there were all the same versions.

Okay cool we'll do that when you get back

see ya!

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 9, 2022

Investigation Notes - round 3

So turns it out to be a discreprency with xterm versions, similar to this #5530

We just tried another run and ripgrep failed in CI so none of lib/vscode/node_modules were installed but CI still passed and our native modules test passed so we need to change that back to --list-extensions.

Re-running again to see what happens
https://github.com/coder/code-server/actions/runs/3661582333

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 10, 2022

TURNS OUT THAT WORKED.

image

Followup for monday:

  • add back --list-extensions (--help only tests native modules for code-server, add note)
  • run e2e on macOS runner (so we don't have to test manually)

@maxbane
Copy link

maxbane commented Dec 11, 2022

I just upgraded code-server to 4.9.0 on an Ubuntu 22.04.1 host (via install.sh), and the terminal no longer works in my iPadOS client. Thought I'd mention it here in case it's related (something about both clients using safari webkit?), but also happy to open a separate issue if preferable.

EDIT: I actually opened a separate issue for iPadOS, because I noticed at least one other bug (unresolved version string in the About window): #5863

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 12, 2022

Apologies! I think that's terminal gpu rendering related. I think I tagged you in another comment:

Settings > Terminal > Gpu Acceleration "off" and now it renders correctly on iPad

Version has been fixed and will be out in the next release!

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Dec 15, 2022

Tested and verified this will be fixed in 4.9.1

@jsjoeio jsjoeio closed this as completed Dec 15, 2022
@jsjoeio jsjoeio modified the milestones: December 2022, 4.9.1 Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority This issue needs to be resolved ASAP
Projects
None yet
Development

No branches or pull requests

2 participants