jwiegley / emacs-async

Simple library for asynchronous processing in Emacs
GNU General Public License v3.0
828 stars 68 forks source link

Process has died #98

Open cjohansson opened 6 years ago

cjohansson commented 6 years ago

Hi! Thanks for a great repo. I have made a integration with it in my project emacs-ssh-deploy and this enabled asynchronous download, upload, diff processes. But if I for instance have multiple asynchronous procesess running via async.el many times I get the message Process has died, do you know why? It almost seems like it only works with one asynchronous process at a time but I am not sure.

jwiegley commented 6 years ago

Interesting, I think adding some logging might help you to track this down.

articuluxe commented 6 years ago

You may already be aware of this, but I thought I would mention in case it helps. I ran into a similar issue when integrating a private library of mine with async. For me the fix was to aggressively remove all output from the asynchronous process. Even (setq inhibit-message t) in the other process was not enough, just one stray message would lead to crashes.

On May 28, 2018, at 2:47 PM, John Wiegley notifications@github.com wrote:

Interesting, I think adding some logging might help you to track this down.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

cjohansson commented 6 years ago

I see, thanks for the tip, I’ll try that

FelipeLema commented 4 years ago

I think I just run into this problem.

First thing I noticed is (setq async--procvar …) that lead me to a bunch of defvar (global variables). The use of global variables (or even buffer local variables) is likely to be the root of this issue see https://github.com/jwiegley/emacs-async/issues/98#issuecomment-643379502.

I can translate these variables into unmutable let clauses (which will end up into closure-capturing of values) and the problem is most likely to go away. Will pull up a PR if @jwiegley is willing to accept.

FelipeLema commented 4 years ago

@cjohansson I think the problem lies somewhere around tramp setting the ControlMaster option, probably a race condition between separate ssh processes that test/create the control master socket

try the following

(async-start
     `(lambda ()
        (let ((tramp-use-ssh-controlmaster-options nil))
          ;; …
          ))
     ;; …
     )
FelipeLema commented 4 years ago

worth mentioning: using defvar doesn't look like the root of the issue.

I thought that there was a race condition between a master Emacs process and a worker Emacs process dying. The fact is that the "Process has died" is an error in tramp that happens in the worker process that is correctly forwarded back to the master process.

cjohansson commented 4 years ago

Just want to add that this doesn’t happen when running tramp in multiple threads, it only happens with multiple processes.. maybe it’s an Emacs issue

FelipeLema commented 4 years ago

@cjohansson did setting tramp-use-ssh-controlmaster-options to nil work for you? I haven't bumped into this error since I started setting it.