LaTeX-Workshop: Killing the build process makes vscode crash when pkill is provided by proctools

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, restart VS Code, and check that you still see this issue.

You still see this issue?: Yes (sporadically)

Make sure to visit the wiki FAQ before filling an issue.

You visited the wiki?: Yes

If your issue is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

You can compile a TeX document manually?: No, but this is precisely the point

Describe the bug [Required]

Sometimes a build hangs, but when I do “Kill LaTeX Compiler Process”, it crashes VS Code.

To Reproduce

Steps to reproduce the behavior:

  1. Create a TeX document that hangs.
  2. Observe never-ending build-in-progress status in bottom-right of window: Screenshot 2021-01-18 at 03 35 32.
  3. Perform command “Kill LaTeX Compiler Process”.
  4. Observe VS Code crash (immediate, no dialog or information screen).

Expected behavior

Simply a peaceful termination of the LaTeX compiler process – not a crash of the entire VS Code app, naturally.

Logs [Required]

LaTeX Workshop Output [Required]

https://gist.github.com/0052a9d49640b2082303d4402df4640f

LaTeX Compiler Output

https://gist.github.com/53d6e54ebc347f2bdcb82297bd547299

Output from manually running latexmk command in terminal

https://gist.github.com/285257e52d062373d4f46327744041d1

Developer Tools Console [Required]

https://gist.github.com/abf948c0194689c6e8426a916746170f

Screenshots

See above.

Desktop [Required]

  • OS: macOS 11.1
  • VS Code version: 1.52.1
  • Extension version: 8.15.0
  • TeX distribution version: TeX Live 2020

Additional questions

Are you using VSCodium?

No

Are you using LaTeX Workshop with VS Code Remote?

No

Additional context

Sample TeX document that causes hanging

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I think I have the kill issue. In the kill function, we first kill all processes with parent pid equal the pid of latexmk and then kill latexmk itself

https://github.com/James-Yu/LaTeX-Workshop/blob/afa3d71e8610db036087a11e03a0555664954f8f/src/components/builder.ts#L54-L62

Yet, the killing of child processes is done asynchronously. I suspect the parent process gets killed before the children (which are not killed because they are detached) and then they become orphans and are not killed by the pkill -P command. Using cp.execSync fixes the issue.

@alexreg Could you try the code from the master branch on Big Sur? See https://github.com/James-Yu/LaTeX-Workshop/blob/master/CONTRIBUTING.md if you do not know how to do this. Thanks for your help.

#2491

Following up on issue #2484, the crash upon “Kill LaTeX Compiler Process” still occurs as before, having disabled all other extensions.

https://gist.github.com/alexreg/3774664b1f8a8675b4f74edb1cd449d6