James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.64k stars 532 forks source link

LaTeX Workshop no longer activates on large directory #3907

Closed teoric closed 1 year ago

teoric commented 1 year ago

Please fill the following fields with a star (*) and provide as much related information as possible.

Pre-checks*

Please change the following [ ] to [x] for confirmation.

  • [x] The issue has not been reported in this repository.
  • [x] The issue remains after disabling all other extensions and restarting Visual Studio Code.
  • [x] The FAQ cannot address the issue.
  • [x] The issue is not related to compiling a document, or the document can be successfully compiled in the OS terminal but not in Visual Studio Code with this extension.

Environment*

Please write exact version numbers instead of descriptors such as latest.

  • Operating System: Windows 10, Ubuntu 23.04, Fedora 38
  • Visual Studio Code Version: 1.78.2
  • LaTeX Workshop Version: 9.11.3 to (at least) 9.11.4
  • TeX Distribution Version: TeXlive 2023 and MikTeX

The Issue*

Please briefly describe the issue you come across.

After 9.11.2, in a rather big directory containing LaTeX sources for different documents, LaTeX Workshop does not activate, but a lot of CPU is used (no helper processes seem to run, just Code). (I've left it for half an hour, and behaviour did not change.) I.e., one cannot execute commands: For any command, in the status bar, "Activating Extensions…" appears, but nothing happens.

This does not occur in smaller repositories, but everything has worked fine up to 9.11.2.

As this happens on Windows and on Linux and on different TeX distributions, it seems to be something general?

Reproduction Steps

Please list out the steps to reproduce your bug. Include relevant environmental variables or any other configuration.

  1. Open the directory.
  2. Open any(!) LaTeX file.

(Though these files are of different size, have different roots etc., all lead to the same behaviour.)

Expected Behavior

What were you expecting to see? Include any relevant examples or documentation links.

I expected the extension to activate and commands to execute.

Logs

LaTeX Workshop Output*

Please paste the whole log messages below, not parts of ones. The log should start with New log placeholder %WS1% registered.

[11:29:58][Logger] New log placeholder %WS1% registered for /home/user/Texte/Uni_vertraulich/LV .
[11:29:58][Manager] Set $LATEXWORKSHOP_DOCKER_LATEX: ""
[11:29:58][Server] Creating LaTeX Workshop http and websocket server.
[11:29:58][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":33485} .
[11:29:58][Extension] Initializing LaTeX Workshop.
[11:29:58][Extension] Extension root: /home/user/.vscode/extensions/james-yu.latex-workshop-9.11.4
[11:29:58][Extension] $SHELL: /usr/bin/zsh
[11:29:58][Extension] $LANG: de_DE.UTF-8
[11:29:58][Extension] $LC_ALL: de_DE.UTF-8
[11:29:58][Extension] process.platform: linux
[11:29:58][Extension] process.arch: x64
[11:29:58][Extension] vscode.env.appName: Visual Studio Code
[11:29:58][Extension] vscode.env.remoteName: undefined
[11:29:58][Extension] vscode.env.uiKind: 1
[11:29:58][Extension] LaTeX Workshop initialized.
[11:29:58][Format][Bib] Bibtex format config: {"tab":"  ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]}
[11:29:58][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{"]
[11:29:58][Manager] Current workspace folders: ["file://%WS1%"]
[11:29:58][Manager] Found magic root %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex from active.
[11:29:58][Manager] Finalized magic root %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Manager] Root file changed: from undefined to %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex
[11:29:58][Manager] Start to find all dependencies.
[11:29:58][Manager] Root file languageId: latex
[11:29:58][Event] ROOT_FILE_CHANGED: "%WS1%/Aussprache-Hist/Anfang/folien-Hist.tex"
[11:29:58][Cacher][Watcher] Reset.
[11:29:58][Cacher] Adding %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Cacher][Watcher] Watched %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex with a new watcher on %WS1%/Aussprache-Hist/Anfang .
[11:29:58][Event] FILE_WATCHED: "%WS1%/Aussprache-Hist/Anfang/folien-Hist.tex"
[11:29:58][Cacher] Caching %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Cacher] Input %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex from %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Cacher] Adding %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:58][Cacher][Watcher] Watched %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:58][Event] FILE_WATCHED: "%WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex"
[11:29:58][Cacher] Caching %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:58][Cacher] Updated inputs of %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:58][Cacher] Parse LaTeX AST with fast-parse: %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:58][Cacher] Input %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex from %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Cacher] Adding %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:58][Cacher][Watcher] Watched %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:58][Event] FILE_WATCHED: "%WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex"
[11:29:58][Cacher] Caching %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:58][Cacher] Updated inputs of %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:58][Cacher] Parse LaTeX AST with fast-parse: %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:58][Cacher] Updated inputs of %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Cacher] Parse LaTeX AST with fast-parse: %WS1%/Aussprache-Hist/Anfang/folien-Hist.tex .
[11:29:58][Event] ROOT_FILE_SEARCHED
[11:29:58][Cacher] Parsed LaTeX AST: %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:59][DupLabel] Checking for duplicate labels: %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:59][Cacher] Updated elements of %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:59][Cacher] Updated bibs of %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:59][Cacher] Cached %WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex .
[11:29:59][Event] FILE_PARSED: "%WS1%/Aussprache-Hist/Anfang/Hist-Grundlagen.tex"
[11:29:59][Cacher] Parsed LaTeX AST: %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:59][DupLabel] Checking for duplicate labels: %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:59][Cacher] Updated elements of %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:59][Cacher] Updated bibs of %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:59][Cacher] Cached %WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex .
[11:29:59][Event] FILE_PARSED: "%WS1%/Aussprache-Hist/Anfang/Hist-19-Jh.tex"
[11:29:59][Server] valdOrigin is http://127.0.0.1:33485

Developer Tools Console

Please paste the whole log messages below, not parts of ones. This console logs can sometimes be very important in many cases. To access the log, click Help -> Toggle Developer Tools -> Console.

WARN Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.vscode-selfhost-test-provider' wants API proposal 'testContinuousRun' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json.
New grammar file: file:///home/user/.vscode/extensions/james-yu.latex-workshop-9.11.4/syntax/TeX.tmLanguage.json
register @ TMScopeRegistry.ts:45
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json.
New grammar file: file:///home/user/.vscode/extensions/james-yu.latex-workshop-9.11.4/syntax/LaTeX.tmLanguage.json
register @ TMScopeRegistry.ts:45
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json.
New grammar file: file:///home/user/.vscode/extensions/james-yu.latex-workshop-9.11.4/syntax/Bibtex.tmLanguage.json
register @ TMScopeRegistry.ts:45
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.
New grammar file: file:///home/user/.vscode/extensions/james-yu.latex-workshop-9.11.4/syntax/markdown-latex-combined.tmLanguage.json
register @ TMScopeRegistry.ts:45
TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.
New grammar file: file:///home/user/.vscode/extensions/james-yu.latex-workshop-9.11.4/syntax/cpp-grammar-bailout.tmLanguage.json
register @ TMScopeRegistry.ts:45
log.ts:421  INFO [perf] Render performance baseline is 29ms

Anything Else?

Add any other context about the problem below.

James-Yu commented 1 year ago

Unfortunately, I cannot reproduce the issue. I'm afraid that you may need to provide a working example with private data remove for debug.

teoric commented 1 year ago

Thank you very much for your reply! Preparing data may take some time, as the directory is so convoluted and mixed. Maybe I should try to compile the extension myself, trying to check which of the code changes caused the change in behaviour? (Between 9.11.2 and 9.11.3 there were not too many, if I see correctly.) Either way it may take at least two or three weeks; sorry for that. (But the good news is that 9.11.2 works for perfectly for me.)

Would it make sense to leave this bug report open to see whether others are affected, too?

ct85711 commented 1 year ago

I will mentioned, that I too encountered the same issue. I will also say, I did see the issue on my large project (well over 1k+ documents). On my end, I can't tell 100% if the extension was timeout or what; as it kept wanting to reload the extension. I did however see, when I was compiling my project, all of my processor was spent on vscode's node binary and not on the luatex binary compiling my files. The other part I noticed, is that the memory usage had a huge spike in usage. To put in perspective, on my 32GB machine, 9.10.0 on vscode used about 6G; on the current latest 9.11.4 memory usage was over 30GB when I forced vscode to close.

A MWE may be difficult to make, as like @teoric, the part that makes the it difficult, is that we are working on projects with numerous files. I'll play around see if I can make an working example later tonight (might not be as minimal).

VSCode Info: Version: 1.78.2 Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435 Date: 2023-05-10T14:47:05.613Z Electron: 22.5.2 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Linux x64 6.1.0-9-amd64 Sandboxed: Yes

ct85711 commented 1 year ago

Ok, I made a workable example; and while watching the extension's logs and also my process monitor (top in linux) I have narrowed down more of the issue. Again, this is tested with version 9.11.4.

To start with, a simple working example: Main.tex

% !TeX root = main.tex

\documentclass{article}
\usepackage{blindtext}
\begin{document}
\tableofcontents

\include{subdoc}

\include{subdoc1}
\include{subdoc2}
\include{subdoc3}
\include{subdoc4}
\include{subdoc5}
\include{subdoc6}
\include{subdoc7}
...
% \include{subdoc1999}
% \include{subdoc2000}
\end{document}

subdoc$x.tex

\Blinddocument

All the subdocs are the same; the more subdocs you have the more the issue is shown. On this working example, 500 was sufficient to see the effects, but more makes the effect last longer. The contents of the subdocs doesn't matter; the main thing is that it's not empty and the quantity of files.

The cause of the issue, is specifically the parsing all the files one after another (hence if you have a faster computer, you'll need more subdocs). In this example, the parsing is super simple (only a single line), so the effect is only a temporary thing. Once the extension parses all the files, it looks like the extension activates. I suspect if the extension does the parsing loop again, will trigger the issue all over. I suspect the excessive memory I encountered, is more of the extension keeping the files in memory (obviously non-existent with this example).

In case you want the extension's log for this example. log.txt

James-Yu commented 1 year ago

Thanks for the information. I will look into the issue, though it may need some more time than usual.

AetherDim commented 1 year ago

I have also the same issue (#3901).

ServerTech commented 1 year ago

I also have the same issue. Downgrading to v9.11.2 fixes the problem.

siebenkopf commented 1 year ago

The exact same behavior here on my side. Here are some more observations:

Also here, downgrading to v 9.11.2 fixes all of these issues.

FvNCCR228 commented 1 year ago

The exact same behavior here on my side. Here are some more observations:

  • loading the extension got more slow than before (v9.1.2)
  • loading the extension also seems to block the loading of other extensions
  • when the extension does not load, I cannot even type text in LaTeX documents, any key stroke (except for the backspace, deleting text works) is lost.
  • when I open a document for which the extension finally loads in a new window (this can take several seconds), and I open another document (for which it does not initially load) in the same workspace, then the extension is disabled again and also does not work for the initial document any longer.

Also here, downgrading to v 9.11.2 fixes all of these issues.

Yes. After the plugin was updated to version 9.11.4 today, it has been in a loading state and the system CPU consumption is very high. It returned to normal after restoring to version 9.11.2. System environment: VSCode + WSL (Ubuntu 2204).

James-Yu commented 1 year ago

Surprisingly, this seems to be caused by a single-worker-based LU parser, which also exists before 9.11.3. As we are in the process of transferring from LU to unified-latex for parsing, this temporary fix will become obsolete in future versions.

teoric commented 1 year ago

Hi James,

Wow, thank you very much for your speedy solution! You were faster fixing the issue than I was providing data.

Impressed regards, Bernhard

Am So., 4. Juni 2023 um 13:57 Uhr schrieb James Yu @.***

:

Closed #3907 https://github.com/James-Yu/LaTeX-Workshop/issues/3907 as completed via 0953de2 https://github.com/James-Yu/LaTeX-Workshop/commit/0953de27121b162036e3caa7708eddd7445e557a .

— Reply to this email directly, view it on GitHub https://github.com/James-Yu/LaTeX-Workshop/issues/3907#event-9424676312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGWCD6YAYFJVJLVS6A547TXJRZZNANCNFSM6AAAAAAYTXU3YM . You are receiving this because you were mentioned.Message ID: @.***>

James-Yu commented 1 year ago

Hi James, Wow, thank you very much for your speedy solution! You were faster fixing the issue than I was providing data. Impressed regards, Bernhard

Thanks for the compliment! Though I am not sure whether the fix can indeed provide a temp solution to the issue. I will keep an eye on this.