Skip to content

Flymake creates a ton of file handles and processes #1704

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

Closed
jakub-w opened this issue Apr 18, 2020 · 6 comments
Closed

Flymake creates a ton of file handles and processes #1704

jakub-w opened this issue Apr 18, 2020 · 6 comments

Comments

@jakub-w
Copy link

jakub-w commented Apr 18, 2020

With emacs -q when editing in haskell-mode and having flymake-mode enabled, flymake frequently creates a new process and a handle for the temporary file, quickly exhausting the limit for open files.

It seems to create a new process whenever a newline is inserted or file is saved.

Can anyone reproduce it or is it just me?

@purcell
Copy link
Member

purcell commented Apr 19, 2020

I haven't use the built-in flymake support tbh, so I don't know if there's a mechanism for throttling that checking, or aborting overlapping checks. I use dante myself, where the checking is cheaper, but it hooks into flycheck rather than flymake. ghcide works with eglot, fwiw, which is a less over-engineered LSP front-end than lsp-mode and it uses flymake.

@jakub-w
Copy link
Author

jakub-w commented Apr 19, 2020

It looks like it can be reproduced easily and is not specific to my environment. I checked with a clean docker setup. Also it doesn't matter if it's built-in or elpa flymake.

Will this be investigated? I've seen some similar reported issues and it seems like the consensus was pretty much this:

Lets agree to use flycheck instead of flymake, flycheck is better at handling temporary files.

Originally posted by @gracjan in #130 (comment)

@purcell I used eglot with hie and this is how I stumbled upon this problem. Listing alternatives doesn't solve anything. If the official stance is to use flycheck the broken code specific to flymake should be removed.

Eglot with flymake happily work in haskell-mode buffer after the workaround is applied:

(eval-after-load 'haskell-mode
    '(setq flymake-allowed-file-name-masks
	   (remove '("\\.l?hs\\'" haskell-flymake-init)
		   flymake-allowed-file-name-masks)))

@purcell
Copy link
Member

purcell commented Apr 20, 2020

Will this be investigated?

Listing alternatives doesn't solve anything.

If the official stance is to use flycheck the broken code specific to flymake should be removed.

There are no very active maintainers here, and I dip in as and when I have a little time. If you would like this to be investigated, your help would be appreciated. In theory the flymake support in recent Emacsen is comparable to flycheck, but I have not tried it out enough to diagnose whether this is the case or to have any particular recommendations on this issue.

@harinath
Copy link

harinath commented May 22, 2020

I found that running 'M-x haskell-check' once in the buffer solved the issue. Seemingly in

(defun haskell-flymake-init ()
  "Flymake init function for Haskell."
  (let ((checker-elts (and haskell-saved-check-command
                           (split-string haskell-saved-check-command))))
    (list (car checker-elts)
          (append (cdr checker-elts)
                  (list (haskell-flymake-create-temp-buffer-copy
                         'flymake-create-temp-inplace))))))

'haskell-saved-check-command' is usually null, unless 'haskell-check' is run. Maybe the '(and haskell-saved-check-command' clause should be moved outside the 'let', so that flymake-init will return null instead?

@purcell
Copy link
Member

purcell commented May 22, 2020

Good find, @harinath - I made this change in 6e8e947.

@purcell
Copy link
Member

purcell commented May 28, 2020

Since I have added the fix which @harinath reported, I'll go ahead and close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants