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

Extension crashing in WSL #329

Closed
daimor opened this issue May 20, 2024 · 16 comments
Closed

Extension crashing in WSL #329

daimor opened this issue May 20, 2024 · 16 comments
Assignees
Labels
bug Something isn't working

Comments

@daimor
Copy link
Collaborator

daimor commented May 20, 2024

What it's going on, how to make it working?
IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.1.1 (Build 374U) Tue Oct 18 2022 17:51:36 EDT
Switched on trace, but nothing useful there
image

Looks like it happening not for every class, only one particular

[Error - 2:39:06 PM] The InterSystems Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

[Error - 2:39:06 PM] Client InterSystems Language Server: connection to server is erroring.
write EPIPE
[Error - 2:39:06 PM] Server process exited with code 1.
[Info  - 2:39:06 PM] Connection to server got closed. Server will restart.
true
[Trace - 2:39:06 PM] Sending request 'initialize - (0)'.

........

[Error - 2:39:06 PM] Client InterSystems Language Server: connection to server is erroring.
write EPIPE
/root/.vscode-server/extensions/intersystems.language-server-2.5.0/server/out/server.js:2
[Error - 2:39:06 PM] The InterSystems Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

@daimor
Copy link
Collaborator Author

daimor commented May 20, 2024

And why issue with just one file, affects the whole extension. If it caught something that it can't process just die, and does not work anymore, until reload

@daimor
Copy link
Collaborator Author

daimor commented May 20, 2024

Managed to get minimal reproducible class, the issue in © in description

/// ©
Class User.crash
{

}

@isc-bsaviano
Copy link
Contributor

Hi @daimor, if you roll back to version 2.4.4 does the issue persist? I couldn't reproduce this on my Mac or PC, but I don't have WSL set up.

@daimor
Copy link
Collaborator Author

daimor commented May 22, 2024

Installed 2.4.4, no difference also crashed

@daimor
Copy link
Collaborator Author

daimor commented May 22, 2024

Looks like it's happening on any unicode symbol anywhere in the code

@daimor
Copy link
Collaborator Author

daimor commented May 22, 2024

[Trace - 11:49:46 AM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///root/Projects/CAM/test.mac",
        "languageId": "objectscript",
        "version": 1,
        "text": "ROUTINE test \ntest ;\n    #; тест"
    }
}


[Trace - 11:49:46 AM] Sending request 'textDocument/codeAction - (1)'.
Params: {
    "textDocument": {
        "uri": "file:///root/Projects/CAM/test.mac"
    },
    "range": {
        "start": {
            "line": 0,
            "character": 0
        },
        "end": {
            "line": 0,
            "character": 0
        }
    },
    "context": {
        "diagnostics": [],
        "triggerKind": 2
    }
}


[Trace - 11:49:46 AM] Sending request 'textDocument/documentSymbol - (2)'.
Params: {
    "textDocument": {
        "uri": "file:///root/Projects/CAM/test.mac"
    }
}


[Trace - 11:49:46 AM] Sending request 'textDocument/semanticTokens/full - (3)'.
Params: {
    "textDocument": {
        "uri": "file:///root/Projects/CAM/test.mac"
    }
}


[Trace - 11:49:46 AM] Sending request 'textDocument/diagnostic - (4)'.
Params: {
    "textDocument": {
        "uri": "file:///root/Projects/CAM/test.mac"
    }
}


[Trace - 11:49:46 AM] Sending request 'textDocument/documentLink - (5)'.
Params: {
    "textDocument": {
        "uri": "file:///root/Projects/CAM/test.mac"
    }
}


/root/.vscode-server/extensions/intersystems.language-server-2.5.0/server/out/server.js:2
[Info  - 11:49:46 AM] Connection to server got closed. Server will restart.
true
[Trace - 11:49:46 AM] Sending request 'initialize - (0)'.

@daimor
Copy link
Collaborator Author

daimor commented May 22, 2024

isclexer = require('./isclexer.node');

moniker = "INT";

console.log(isclexer.Tokenize(' ; test',moniker));
console.log(isclexer.Tokenize(' ; тест',moniker));
$  bug node bug.js
[ [ { l: 1, s: 7, p: 1, c: 6 } ] ]
/root/Projects/bug/bug.js:6
console.log(isclexer.Tokenize(' ; тест',moniker));
                     ^

Error: std::bad_alloc
    at Object.<anonymous> (/root/Projects/bug/bug.js:6:22)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.13.1
$ uname -a
Linux TAB120657 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

@isc-bsaviano
Copy link
Contributor

@daimor Something similar was reported in #298. Could changing locales fix your issue? If not and VS Code pulled the right extension version (should be the linux-x64 version based on your output) I can try to reproduce this.

@daimor
Copy link
Collaborator Author

daimor commented May 22, 2024

locale is UTF8, no idea which locale to change, I used russian language as an example, I see no reason that it should crash on whatever locale is set
anyway I discovered it for sign © which is not language specific
the codebase I'm working on should be in English only anyway

@isc-bsaviano
Copy link
Contributor

@daimor I upgraded my WSL2 distribution to 22.04 and node to 20 and then tried to reproduce this issue but I couldn't. Here's my terminal output. I used the current version of linux-x64-isclexer.node found in GitHub.

Welcome to Node.js v20.13.1.
Type ".help" for more information.
> const i = require("./linux-x64-isclexer.node")
undefined
> i.Tokenize(" ; text","INT")
[ [ { l: 1, s: 7, p: 1, c: 6 } ] ]
> i.Tokenize(" ; тест","INT")
[ [ { l: 1, s: 7, p: 1, c: 6 } ] ]
> .exit
bsaviano@USSSTbsaviano:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy
bsaviano@USSSTbsaviano:~$ uname -a
Linux USSSTbsaviano 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

@daimor
Copy link
Collaborator Author

daimor commented May 23, 2024

Reproduced in docker

docker run -v .:/demo -w /demo node:20 bug.js

image

@isc-bsaviano
Copy link
Contributor

Is that container running in Docker on WSL or Docker Desktop on windows? Also, what's the base OS of that image, Alpine or some other Linux?

@daimor
Copy link
Collaborator Author

daimor commented May 23, 2024

Docker on WSL
this one is not alpine, with alpine isclexer does not work

@isc-bsaviano
Copy link
Contributor

isc-bsaviano commented May 23, 2024

I was able to reproduce this with the node:20 container image on WSL and using Docker Desktop on my mac. Looks like the image uses Debian and not Ubuntu. I think our Linux binaries are built on Ubuntu. I wonder if that could be a cause.

@isc-bsaviano isc-bsaviano added the bug Something isn't working label Jun 11, 2024
@isc-bsaviano
Copy link
Contributor

@daimor Quick update on this: I was able to get an environment set up to debug this issue. I identified the location of the error, but am still working on the cause.

@isc-bsaviano
Copy link
Contributor

@daimor I determined that this is a character encoding issue. The parsers tried to use an locale that wasn't present, so they fell back to the default locale which doesn't support Unicode. I will have this fixed shortly.

@isc-bsaviano isc-bsaviano self-assigned this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants