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

Spwaning tons of chktex #186

Closed
eyalk5 opened this issue Mar 11, 2020 · 19 comments
Closed

Spwaning tons of chktex #186

eyalk5 opened this issue Mar 11, 2020 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@eyalk5
Copy link

eyalk5 commented Mar 11, 2020

Hi,

texlab has spawned multiple times a lot of chktex processes .
When I say multiple, I mean until the os run out of pipes. That is 1157 process.

ps couldn't resolve their cmdline (why?)
Example:

65967 /Users/eyalkarni/.config/coc/extensions/coc-texlab-data/texlab
66028 (chktex)
66056 (chktex)
66101 (chktex)
66153 (chktex)
66389 (chktex)
66414 /usr/local/Cellar/node/13.1.0/lib/node_modules/node/bin/node /Users/eyalkarni/.config/coc/extensions/node_modules/coc-vimlsp/out/server --node-ipc --clientProcessId=659
66428 (chktex)
66442 (chktex)
66443 /usr/local/Cellar/node/13.1.0/lib/node_modules/node/bin/node /Users/eyalkarni/.config/coc/extensions/node_modules/coc-vimlsp/out/scan.js --node-ipc
66500 (chktex)
66526 (chktex)
73300 (chktex)
73330 (chktex)
73357 (chktex)
73383 (chktex)
73412 (chktex)
73439 (chktex)
73463 (chktex)
73490 (chktex)
73523 (chktex)
73553 (chktex)
73584 (chktex)
73607 (chktex)
73630 (chktex)
73653 (chktex)
73690 (chktex)
73720 (chktex)
73744 (chktex)
73774 (chktex)
73802 (chktex)
73832 (chktex)
73856 (chktex)
73886 (chktex)
73939 (chktex)
73969 (chktex)
73996 (chktex)
74028 (chktex)
74058 (chktex)
74085 (chktex)
74117 (chktex)
74146 (chktex)
74175 (chktex)
74205 (chktex)
74233 (chktex)

Their parent process was /Users/eyalkarni/.config/coc/eetensions/coc-texlab-data/texlab

I would appreciate it if you would fix this.
I work in the environment where I run coc-texlab and vimtex in parallel in neovim.
If it matters. thanks.
The version is "texlab 1.10.0"

@clason
Copy link
Contributor

clason commented Mar 11, 2020

I'm using neovim, vimtex, and texlab via vim-lsp in parallel and do not observe this. Are you sure it's an issue with texlab and not with coc(-texlab)?

@pfoerster
Copy link
Member

Thanks for the report.

Are you sure it's an issue with texlab and not with coc(-texlab)?

I think its an issue with texlab since coc-texlab should never spawn chktex.

texlab has spawned multiple times a lot of chktex processes .
When I say multiple, I mean until the os run out of pipes. That is 1157 process.

That's odd. When does the spamming of chktex happen? Does it happen right at the start or only after editing a file? Do you have latex.lint.onChange on? Do some of the chktex processes die or are they hanging? Can you try running texlab with the -vvvv flag to get some additional logging?

@pfoerster pfoerster self-assigned this Mar 11, 2020
@pfoerster pfoerster added the bug Something isn't working label Mar 11, 2020
@eyalk5
Copy link
Author

eyalk5 commented Mar 15, 2020

I think I have updated the version of the server and it doesn't happen. I haven't done really extensive vimtex session. But will see how it will behave.

@eyalk5
Copy link
Author

eyalk5 commented Mar 21, 2020

OK, it did happen again. It happens after a lot of usage. I can't put my finger on it.
I guess the issue is something like: try to spawn a process.
if it doesn't work partially, try again. if it doesn't work completely, stop.

@eyalk5
Copy link
Author

eyalk5 commented Mar 21, 2020

I saw also

eyalkarni        59145  22.3  0.1  4286820   8892   ??  R     1:31PM   0:00.13 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59029  22.0  0.1  4280624  10008   ??  R     1:31PM   0:00.15 (kpsewhich)
eyalkarni        59095  21.9  0.1  4280676  10036   ??  R     1:31PM   0:00.15 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59099  21.8  0.1  4288816   9284   ??  R     1:31PM   0:00.14 kpsewhich -var-value TEXMF
eyalkarni        58953  21.1  0.1  4306224  10804   ??  R     1:31PM   0:00.17 (kpsewhich)
eyalkarni        59032  21.0  0.1  4280624   9660   ??  R     1:31PM   0:00.15 kpsewhich -var-value TEXMF
eyalkarni        59277  20.8  0.0  4287844   7988   ??  R     1:31PM   0:00.11 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59294  20.7  0.0  4276580   7904   ??  R     1:31PM   0:00.11 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59237  20.7  0.1  4277552   8604   ??  R     1:31PM   0:00.13 kpsewhich -var-value TEXMF
eyalkarni        59263  20.7  0.1  4285796   8488   ??  R     1:31PM   0:00.12 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59205  19.8  0.1  4279600   8980   ??  R     1:31PM   0:00.13 kpsewhich -var-value TEXMF
eyalkarni        59075  19.8  0.1  4287844  10440   ??  R     1:31PM   0:00.16 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59233  19.7  0.1  4278628   9196   ??  R     1:31PM   0:00.14 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59086  19.6  0.1  4278628  10076   ??  R     1:31PM   0:00.15 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59035  19.5  0.1  4288868  10392   ??  R     1:31PM   0:00.16 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59096  19.5  0.1  4287792   9916   ??  R     1:31PM   0:00.15 kpsewhich -var-value TEXMF
eyalkarni        59297  19.5  0.0  4277604   8168   ??  R     1:31PM   0:00.12 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59168  19.4  0.1  4278576   8724   ??  R     1:31PM   0:00.13 kpsewhich -var-value TEXMF
eyalkarni        59207  19.4  0.1  4286768   8876   ??  R     1:31PM   0:00.13 kpsewhich -var-value TEXMF
eyalkarni        59177  19.3  0.1  4279652   8812   ??  R     1:31PM   0:00.13 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        58999  19.3  0.1  4289892  10848   ??  R     1:31PM   0:00.16 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59150  19.3  0.1  4278628   8896   ??  R     1:31PM   0:00.13 chktex -I0 -f%l:%c:%d:%k:%n:%m\012
eyalkarni        59261  19.2  0.1  4279652   8704   ??  R     1:31PM   0:00.12 chktex -I0 -f%l:%c:%d:%k:%n:%m\012

@pfoerster
Copy link
Member

Can you try the latest commit on the master branch? Now, texlab should not spawn more than one ChkTeX instance at a time, which should prevent the spamming of chktex processes.

@eyalk5
Copy link
Author

eyalk5 commented Apr 11, 2020

Thanks, will do. I notice it not too often(when resources are exhausted).

@oblitum
Copy link

oblitum commented Nov 18, 2020

I'm coc-texlab user (also thinking coc-texlab isn't to blame as chktex is called by texlab) and still have the same issue on last release, lots of stale chktex processes until I close texlab.

@eyalk5
Copy link
Author

eyalk5 commented Nov 18, 2020

Try updating everything to the last version and disable ALE. I am not sure how it was resolved

@oblitum
Copy link

oblitum commented Nov 18, 2020

@eyalk5 oh! Many thanks for that tip, it seems totally related to ALE (or vimtex?, or both....), which I haven't disabled for this filetype (uh... actually I've indeed set ALE to not load for tex, latex, bib, bibtex...), which I generally do when coc supports it well.

So possibly ignore my previous report, ALE is aggressive in general and may be calling chktex in some weird way on its own. Really not sure how these chktex processes come up as texlab child (through coc??) when ALE is present.

@eyalk5 eyalk5 changed the title Spwarning tons of chktex Spwaning tons of chktex Nov 19, 2020
@oblitum
Copy link

oblitum commented Nov 29, 2020

Actually, lately I completely removed ALE from my setup and this kept happening. It's not ALE related.

The chktex instances start to leak anytime I run latexmk (or arara), which generates a .log, .out, .aux update, whose contents is picked to provide diagnostics. Can't say exactly where, but the cycle edit/make/edit/make/... is what's causing chktex instances to accumulate.

@pfoerster
Copy link
Member

I will work on a fix once I get the incremental parsing sorted out, which should be relatively soon.

The chktex instances start to leak anytime I run latexmk (or arara), which generates a .log, .out, .aux update

ChkTex should be run, whenever you save a file but not when you are building.

In the mean time, I recommend disabling chktex completely using the settings latex.lint.onChange: false and latex.lint.onSave: false. This way, you should not need to disable ALE.

@oblitum
Copy link

oblitum commented Nov 29, 2020

Okay. As said it actually didn't have any relation with ALE on my side.

@oblitum
Copy link

oblitum commented Nov 29, 2020

ChkTex should be run, whenever you save a file but not when you are building.

Correct, I didn't mean it runs when I build the files, but that having new .log files etc with new diagnostics will make these diagnostics show up when I switch to the editor and save the file the next time ("Can't say exactly where, but the cycle edit/make/edit/make/... is what's causing chktex instances to accumulate").

@pfoerster
Copy link
Member

Can you guys check out PR #408, please?. I think I managed to find the issue. There was an stdout encoding issue, which caused texlab to stop reading the stdout stream of chktex sometimes. With this PR, I cannot reproduce the issue on my machine anymore. Note that the options format has changed a bit (everything is now under the texlab scope). To enable chktex, you can use:

  "texlab.chktex.onEdit": true,
  "texlab.chktex.onOpenAndSave": true,

@oblitum
Copy link

oblitum commented May 14, 2021

@pfoerster it seems I can't try this under coc-texlab in a simple manner as the coc extension would have to align its source code with those option changes. Currently by just changing the texlab executable I'm unable to get chktex to run on edit.

FWIW, additional bit of info: the dangling chktex instances in 2.x are defunct processes.

@pfoerster
Copy link
Member

FWIW, additional bit of info: the dangling chktex instances in 2.x are defunct processes.

This info actually helped debug the issue. It looks like it may be some Rust process API issue to me. The fix with the encoding is not everything and it still hangs sometimes but after not feeding input to stdin it appears to work. In particular, it always hangs a lot on my machine, if I use the stdin handle. Writing to a temp file seems to help. I'll try to make a release soon so you can try it out.

@oblitum
Copy link

oblitum commented May 27, 2021

@pfoerster it seems I'm not hitting this anymore after 3.0.

@oblitum
Copy link

oblitum commented Jun 1, 2021

Been coding latex for a while and this seems to have effectively gone away.

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

4 participants