Open pszmagaj opened 4 years ago
@pszmagaj any chance you could make a public example repo so I can investigate?
@jaredly I cannot share the repo but I can try to create a new project with the same dependencies to reproduce the problem. I may also try to debug the issue by myself but I would need some advice on how it can be done.
@jaredly @pszmagaj I think I've managed to track down the issue. In our project we have two source directories listed in bsconfig.json.
"sources": [
{
"dir": "src",
"subdirs": true
},
{
"dir": "__tests__",
"subdirs": true,
"type": "dev"
}
],
When I remove one of them, the plugin works again. I will try to create minimal reproducible example later.
Edit: After further investigation I've noticed that it's more related to number of directories, not sources. I created empty project with 2 files and 2600 empty directories and RLS stopped working. With 2400 directories it was still doing fine.
Similar issue in spirit (integration wit bsb): https://github.com/jaredly/reason-language-server/issues/414
@selenir do you have a repo with that test?
There it is: https://github.com/selenir/rls-374-repro
I've managed to reproduce the issue on Windows 10, there are some logs in the "Output" tab, which didn't appear on Linux: https://gist.github.com/selenir/371e3b357a662e4f737ed4364ac80734
Also while checking logs I've noticed that each directory in project is passed as -I paramter to bsc. Maybe it could be related to max command length in cmd/bash.
@jaredly Hello. I have investigated a problem and it seems to be linux / ubuntu specific problem. The problem can be recreated using https://github.com/selenir/rls-374-repro. It seems that bsc exits 127 code when run by RLS. The command that RLS uses to compile the project works perfectly when run from command line.
The repro repo causes a problem on Windows and WSL as well however it seems that the cause is different.
[Edit] I think the problem may be related to MAX_ARG_STRLEN which is 32 * PAGE_SIZE (4KB). When command goes below 128kB it starts working. I do not know how to resolve the problem without recompiling the kernel. Perhaps bsc could take arguments from a file?
I can see that OCaml compiler has "args" option (http://caml.inria.fr/pub/docs/manual-ocaml/comp.html#s%3Acomp-options). According to https://bucklescript.github.io/docs/en/extended-compiler-options BSC should inherit options from OCAML compiler but I cannot see args option in BSC.
@bobzhang Perhaps you can help us with that? Can BSC expose "-args" OCAML compiler option?
Can some1 fix this in the reason-language-server :)?
@pszmagaj Any idea why the command line is that long? 128KB seems a lot
@bobzhang It's because BSB passes paths of all subdirectories in the project to the compiler. You can easily reach the 128KB mark when you have bigger project.
@bobzhang I confirm. The project is really big. We have hundreds of Reason and JS modules in a project what makes compiler command very long (~150kB).
@pszmagaj I guess you meant hundreds of directories?
@bobzhang Yes. There are hundreds directories.
Hi,
I have got an unknown error when using vscode plugin.
Plugin version 1.7.4
bs-platform: 5.2.1 but also tried on 7.0.1 with the same effect.
bsconfig.json
The plugin doesn't work. It seems that it cannot compile the code but gets no error. I found in debug log only "type error here " but with no details.
Or something like below (many times for multiple different modules)
The project builds and works when compiling by using npx bsb -make-world Any ideas what it can be?