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

Gauge server initialization error on MacOS #735

Closed
CharlieDigital opened this issue Sep 13, 2021 · 15 comments
Closed

Gauge server initialization error on MacOS #735

CharlieDigital opened this issue Sep 13, 2021 · 15 comments

Comments

@CharlieDigital
Copy link

Describe the bug

When starting VS Code on MacOS, the following errors are shown in the UI:

Failed to create test explorer.
The Gauge server crashed 5 times in the last 3 minutes.  The server will not be restarted.

What command(s) did you run when you found the bug?

Started VS Code

Output, stack trace or logs related to the bug

2021/09/13 15:56:41 jsonrpc2: protocol error: read /dev/stdin: resource temporarily unavailable
2021/09/13 15:56:41 jsonrpc2 handler: sending response 0: jsonrpc2: connection is closed
[Info  - 3:56:41 PM] Connection to server got closed. Server will restart.
2021/09/13 15:56:44 jsonrpc2: protocol error: read /dev/stdin: resource temporarily unavailable
2021/09/13 15:56:44 jsonrpc2 handler: sending response 0: jsonrpc2: connection is closed
[Info  - 3:56:44 PM] Connection to server got closed. Server will restart.
2021/09/13 15:56:47 jsonrpc2: protocol error: read /dev/stdin: resource temporarily unavailable
2021/09/13 15:56:47 jsonrpc2 handler: sending response 0: jsonrpc2: connection is closed
[Info  - 3:56:47 PM] Connection to server got closed. Server will restart.
2021/09/13 15:56:49 jsonrpc2: protocol error: read /dev/stdin: resource temporarily unavailable
2021/09/13 15:56:49 jsonrpc2 handler: sending response 0: jsonrpc2: connection is closed
[Info  - 3:56:50 PM] Connection to server got closed. Server will restart.
2021/09/13 15:56:52 jsonrpc2: protocol error: read /dev/stdin: resource temporarily unavailable
2021/09/13 15:56:52 jsonrpc2 handler: sending response 0: jsonrpc2: connection is closed
[Error - 3:56:53 PM] Connection to server got closed. Server will not be restarted.

Versions

Gauge (Output of gauge -v)

Gauge version: 1.4.1
Commit Hash: a82478a

Plugins
-------
html-report (4.1.2)
js (2.3.17)
screenshot (0.1.0)
ts (0.1.0)
xml-report (0.2.3)

Node.js/Java/Python/.Net/Ruby version

See below.

Operating System information

MacOS

IDE information

Version: 1.60.0 (Universal)
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:54:53.442Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.4.0
@sriv
Copy link
Member

sriv commented Sep 24, 2021

can you check if there are any errors in any of the log files? This is something that comes up when certain errors occur while opening a gauge project.

@CharlieDigital
Copy link
Author

@sriv , where can I grab the log files from?

In this case, it was the default TS template project so there was no additional custom code in it yet.

@sriv
Copy link
Member

sriv commented Sep 24, 2021

You should see the logs under logs directory under the project directory

@chavdim
Copy link

chavdim commented Oct 5, 2021

Is there any advice how to approach this issue? Having similar issues, these were the logs:
when created gauge init js it works fine.

05-10-2021 09:45:43.835 [Gauge] [INFO] Initializing specs cache with 1 specs
05-10-2021 09:45:43.835 [Gauge] [DEBUG] Adding specs from /Users/me/source/template-ts/specs/example.spec
05-10-2021 09:45:43.835 [Gauge] [INFO] Initializing steps cache with 1 steps
05-10-2021 09:45:43.835 [Gauge] [DEBUG] Watching directory: /Users/me/source/template-ts/specs
05-10-2021 09:45:43.836 [Gauge] [DEBUG] Found 1 files
05-10-2021 09:45:43.836 [Gauge] [INFO] Starting language runner
05-10-2021 09:45:46.201 [Gauge] [DEBUG] Attempting to connect to grpc server at port: 50833
05-10-2021 09:45:46.204 [Gauge] [DEBUG] Successfully made the connection with runner with port: 50833
05-10-2021 09:45:46.204 [Gauge] [INFO] LangServer: reading on stdin, writing on stdout
05-10-2021 09:45:46.415 [Gauge] [DEBUG] Runner with PID:8940 has exited
05-10-2021 09:45:46.415 [Gauge] [INFO] Connection closed
05-10-2021 09:45:46.415 [Gauge] [ERROR] Unable to log error 'Connection closed' to LSP: jsonrpc2: connection is closed

@mholetzko
Copy link

mholetzko commented Oct 6, 2021

Hey there,

I have the same issue and can confirm the log of @chavdim - here is mine:

06-10-2021 17:01:41.151 [Gauge] [INFO] Initializing concepts cache with 0 concepts
06-10-2021 17:01:41.153 [Gauge] [INFO] Initializing specs cache with 9 specs
06-10-2021 17:01:41.153 [Gauge] [DEBUG] Adding specs from /Users/matmycmpny/mycmpny/workspace/e2e-tests/mycmpny.appl/specs/mycmpnySmokeTests.spec
(... some more specs) 
06-10-2021 17:01:41.153 [Gauge] [INFO] Initializing steps cache with 9 steps
06-10-2021 17:01:41.153 [Gauge] [INFO] Starting language runner
06-10-2021 17:01:41.153 [Gauge] [DEBUG] Watching directory: /Users/matmycmpny/mycmpny/workspace/e2e-tests/mycmpny.appl/specs
06-10-2021 17:01:41.153 [Gauge] [DEBUG] Found 6 files
(... some more dirs)
06-10-2021 17:01:43.453 [Gauge] [DEBUG] Attempting to connect to grpc server at port: 58450
06-10-2021 17:01:43.456 [Gauge] [DEBUG] Successfully made the connection with runner with port: 58450
06-10-2021 17:01:43.456 [Gauge] [INFO] LangServer: reading on stdin, writing on stdout
06-10-2021 17:01:43.457 [Gauge] [DEBUG] jsonrpc2: --> request #0: initialize: {...can share the log if required}
06-10-2021 17:01:43.457 [Gauge] [DEBUG] jsonrpc2: protocol error: read /dev/stdin: resource temporarily unavailable
06-10-2021 17:01:43.457 [Gauge] [DEBUG] jsonrpc2 handler: sending response 0: jsonrpc2: connection is closed
06-10-2021 17:01:43.668 [Gauge] [DEBUG] Runner with PID:35256 has exited
06-10-2021 17:01:43.668 [Gauge] [INFO] Connection closed
06-10-2021 17:01:43.668 [Gauge] [ERROR] Unable to log error 'Connection closed' to LSP: jsonrpc2: connection is closed

What I additionally checked is:

  • I can successfully start a gauge language server with:
gauge daemon --dir /... --lsp -l debug

When I change the language in the manifest to "js", the extension works (but doesn't recognise the step implementations :) )
This also confirms the point from @chavdim

{
  "Language": "ts",
  "Plugins": ["html-report"]
}

Hence my question to you guys @sriv / gauge team - on your project page of the vs-code extension you mention, that the gauge extension only works for the following language-plugins:

  • gauge-js
  • gauge-java
  • gauge-dotnet
  • gauge-python
  • gauge-ruby

@BugDiver mentions on the gauge-ts page that the typescript plugin should als work - what is now correct? :) - do we need a feature request? If someone gives me a quick-brush I am happy to contribute.

Gauge supports LSP which can be used to used to integrate Gauge with any (if it supports) LSP. Gauge has it’s official plugin for Visual Studio Code which allows author/debug to write their tests in multiple language.

Gauge-Ts follows the protocol and implements the apis required by gauge to support a language. Install the gauge plugin for VS Code for a rich editing and debugging support with Gauge and Typescript.

@sriv
Copy link
Member

sriv commented Oct 12, 2021

Thanks for sharing the logs, I can see this issue myself!

Now, as for the typescript support for gauge-vscode goes, I can say that we do not have tests to cover typescript! See https://github.com/getgauge/gauge-lsp-tests/tree/master/env

This means, that the CI build test (and certify) that gauge-vscode will work for java, ruby, js, dotnet (C#), python.

gauge-ts seems to have the implementations in place to enable gauge-vscode editing, but it seems like there is some issue bootstrapping this. I will take a deeper look, but as it stands today it looks like there needs to be more work done to bring this feature in. Apologies if the documentation was misleading!

@mholetzko
Copy link

Alright - that's good and bad news :) I'll also try to play around and try to understand a little more.

We can work, so we are not completely blocked, but if you could drive a Mercedes you don't want the Opel 😋

Thanks a lot for your feedback so far @sriv

M.

@BugDiver
Copy link
Member

@CharlieDigital @mholetzko I have updated the gauge typescript template. Could you please verify

  • create a new project by running gauge init ts
  • Open in Vs Code, and verify if it's working

If you already have a typescript project please try follwing to see if that fixes your issue

  • Run npm install --save ts-node
  • Run npm install --save typescript
  • Reload/Open project in vscode

@mholetzko
Copy link

Hey,

Awesome I just checked it out.

A fresh 'gauge init ts' works now like a charm!

In my existing project I simply pinned the ts-node and typescript versions you have mentioned in the template. And that works as well :)

Thanks a lot - at least within my team I expect a bunch of happy faces on Monday 🙂

Thanks a lot to everyone who has contributed 🙏🏼

Matthias

@CharlieDigital
Copy link
Author

@BugDiver also confirm that it works for new projects via gauge init ts but the suggested commands for existing projects do not work.

It's not an issue as it's easy enough to move files around I suppose.

Thanks to the folks for getting this patched!

@gobbi9
Copy link

gobbi9 commented Nov 1, 2021

@BugDiver as of today gauge init ts and npm install produce the same language server error, I just tested it again. Maybe the template must be updated again? I do not have much experience with Javascript, but is the problem caused because the different versions of the ts-node and typescript libraries?

in package-lock.json I have:

"gauge-ts": {
      "version": "0.1.0",
      "resolved": "https://registry.npmjs.org/gauge-ts/-/gauge-ts-0.1.0.tgz",
      "integrity": "sha512-ZVxe1+Vi84O8D5XaMdOwG6UkHBlJ4T5OYHgIaZfhvYAwjyzFjXmINqHt7j1TvaPFwzqym6uJHcme/Hvr3I977Q==",
      "requires": {
        "@grpc/grpc-js": "^1.1.5",
        "google-protobuf": "^3.13.0",
        "klaw-sync": "^6.0.0",
        "ts-node": "^9.0.0",
        "typescript": "^4.0.3",
        "uuid": "^8.3.0"
      },
      "dependencies": {
        "ts-node": {
          "version": "9.1.1",
          "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz",
          "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==",
          "requires": {
            "arg": "^4.1.0",
            "create-require": "^1.1.0",
            "diff": "^4.0.1",
            "make-error": "^1.1.1",
            "source-map-support": "^0.5.17",
            "yn": "3.1.1"
          }
        }
      }
    }

whereas in package.json

{
  "name": "gauge-ts-template",
  "description": "Starter template for writing TypeScript tests for Gauge",
  "dependencies": {
    "gauge-ts": "0.1.0",
    "ts-node": "^10.4.0",
    "typescript": "^4.4.4"
  },
  "devDependencies": {
    "@types/node": "latest",
    "taiko": "^1.0.26"
  }
}

Thanks in advance.

@mholetzko
Copy link

I was just checking the differences.

I verified https://github.com/getgauge/template-ts/releases/tag/v0.0.6

In 0.0.7,0.0.8 two new versions have been bumped, hence I assume that gauge itself might have been updated. Otherwise to make it work I would suggest you pin the versions for your project to the ones in https://github.com/getgauge/template-ts/releases/tag/v0.0.6.

@BugDiver
Copy link
Member

BugDiver commented Nov 1, 2021

I verified https://github.com/getgauge/template-ts/releases/tag/v0.0.6

Is this version working for you?

@gobbi9
Copy link

gobbi9 commented Nov 2, 2021

yes, setting these versions in package.json solved it. Thanks 👍

    "ts-node": "^8.7.0",
    "typescript": "^3.8.3"

@AndyBrownlie
Copy link

I know this issue has been open for a while, but I'd just like to highlight that after having similar issues with the VSCode extension getGauge install (couldn't tie step implementations to spec steps -> implementation not found errors) that I was able to get this working by following a similar path as suggested by BugDiver:

  • npm install gauge-ts@latest
  • npm install ts-node
  • npm install typescript
  • reload VSCode

I'm not sure what the issue is with the extension, and I'm not sure if this is related but I did notice the following error in the log when installing:

17-03-2023 09:45:06.942 [Gauge] [ERROR] Unable to log error 'Connection closed' to LSP: jsonrpc2: connection is closed G] Found 1 files

bockstaller added a commit to bockstaller/getgauge-gauge that referenced this issue Oct 26, 2023
The getgauge/common upgrade solves the issue
where the gauge server crashes whenever a project is loaded
that uses the ts plugin.

The cause is described here getgauge#2419

This commit closes/permanently fixes issues like
getgauge/gauge-vscode#735
getgauge/gauge-vscode#636
getgauge/gauge-vscode#885

Signed-off-by: Lukas Bockstaller <lukas.bockstaller@posteo.de>
chadlwilson added a commit to getgauge/gauge that referenced this issue Oct 27, 2023
* Upgrade getgauge/common to solve ts issue

The getgauge/common upgrade solves the issue
where the gauge server crashes whenever a project is loaded
that uses the ts plugin.

The cause is described here #2419

This commit closes/permanently fixes issues like
getgauge/gauge-vscode#735
getgauge/gauge-vscode#636
getgauge/gauge-vscode#885

Signed-off-by: Lukas Bockstaller <lukas.bockstaller@posteo.de>

* Tidy Go modules

Signed-off-by: Chad Wilson <chadw@thoughtworks.com>

* Bump Gauge version

Signed-off-by: Chad Wilson <chadw@thoughtworks.com>

---------

Signed-off-by: Lukas Bockstaller <lukas.bockstaller@posteo.de>
Signed-off-by: Chad Wilson <chadw@thoughtworks.com>
Co-authored-by: Chad Wilson <chadw@thoughtworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants