Closed jthaman closed 3 years ago
If you manage to find a reproducible procedure for triggering that bug, can you please post a trace? You can generate one with M-x ess-elisp-trace-mode
. Given the amount of output, this likely won't be practical unless you can systematically trigger the bug though.
Another way that is less informative but also less verbose and intrusive is to set (setq ess-verbose t)
. You can then find a log in the *ESS*
buffer.
Hi Lionel, I can sort of reproduce the bug, at least on my setup.
ess-eval-region-or-function-or-paragraph-and-step
)library(stats)
. The process will disconnect while typing this command.ESS dribble is at https://gist.githubusercontent.com/jthaman/c800d0554ba50ca44dfa8f782576ee63/raw/7c8cd9c497d11afd8c5fb6f8bf8c0c682373a9a8/gistfile1.txt
Tracebug output (separate session from the dribble, but same steps to reproduce): https://gist.githubusercontent.com/jthaman/4bd101183700d45a1d000f12738435ec/raw/a8630d5a3290db5e57b5aaa6939ea01b635b48a0/tracebug-output.txt
I think I know where this comes from. On the timeout-interrupt (#1104) the process is somehow stuck in the temporary buffer and not returned back to the original buffer. It doesn't happen always, only sometimes. This is why it's so difficult to debug.
When this happens, and the temporary buffer is still there, try C-c C-z. You will be brought to the temp buffer because the ESS process association is using processes, not buffers.
I'm also experiencing similar behavior.
@jthaman check that your remote ESS process initializes correctly. For me, it seems it times out, due to the issue linked by @vspinu
Specifically, I load up remote R, then (ess-remote)
and the initialization times out:
ess-command: Timeout during background ESS command ‘{##' Source FILE into an environment. ...
I'm trying to increase timeout but I am unsuccessful. Currently trying something like:
(ess-command (ess-remote "*shell*" "R") :timeout 10)
@pavopax Paul, I may look into that.
I've now run into the bug on Emacs 26.3, and updated the issue. I don't think Emacs version explains the variance in the bug anymore.
edit: The bug is also occurring while working on local drives.
Thanks for reporting everyone. I've merged an attempt at fixing this (#1106). Can you please try it once melpa has updated and see if that fixes it for you please?
If you're no longer seeing this issue, can you please also try with this:
(setq ess--command-default-timeout 1)
This will cause the timeout errors you've been seeing with remotes (we've bumped the default timeout to 30s in the mean time). It'd be helpful if you could confirm that the process is not lost, i.e. you don't see "Current buffer has no process" after a timeout error.
Thanks so much for this work, Lionel. I'm seeing some improvements, but will continue to test with my R scripts.
I am finding there is now some internal ESS output that gets dumped into the iESS process. For example, I'm seeing some output like
>
(list "base" '(("..." . "") ("na.rm" . "FALSE")) '("..." "na.rm"))
ess-output-delimiter79-END
> >
(list "base" '(("object" . "") ("..." . "") ("digits" . "") ("quantile.type" . "7")) '("object" "..." "intercept" "split" "expand.split" "keep.zero.df" "all" "full" "maxsum" "digits" "quantile.type" "dispersion" "correlation" "symbolic.cor" "test" "tol" "ny" "names" "loadings" "cutoff" "max_frames" "dir" "srcrefs" "useSource"))
ess-output-delimiter80-END
interlaced with my R output.
Do you see anything relevant in *messages*
? Timeout errors?
Nothing in *messages*
, and so far nothing notable in *ESS*
, but I will keep testing. I have not encountered a timeout error yet, but I am encountering some brief flashes of the title bar.
It's unclear to me, but the Windows 10 titlebar repeatedly flashes when I encounter the 'current buffer has no process' error.
Good news, I can reproduce your hardship by inserting this snippet in .ess_funargs()
(which is used on the R side by eldoc):
withCallingHandlers(
interrupt = function(...) Sys.sleep(2),
Sys.sleep(2)
)
The calling handler simulates a long interrupt. This will be helpful to create unit tests that simulate a slow responding process.
With this I see the same behaviour as you just described @jthaman. I also tried it with a version of ESS anterior to #1106 and I could reproduce the process loss. So the PR did fix that particular problem. To fix the remaining issue:
I now realise that we can't block on process interruptions so I'm going to look into interrupting asynchronously.
I also wonder if we could detect slow remotes to automatically disable background commands. This will avoid getting the process busy while a background command is interrupting asynchronously.
@jthaman By the way in the meantime you can set ess-can-eval-in-background
to nil
when you're working with remotes, that should solve the issue by disabling completions.
Nice, I just tested. Setting ess-can-eval-in-background
to nil disables the output. Also makes eldoc go away though :(
Reporting a related bug:
I've been getting a bunch of these new Disabling output delimiter because CMD failed to parse
errors that have been introduced in #1108 referenced above.
More importantly, the remote ESS process is freezing up my whole Emacs, and C-g helps, but it takes a few seconds of frantic cancellation. This is even without sending commands - just trying to navigate my R (Rmd with polymode) buffer, and things hang!
The issue goes away with: "Setting ess-can-eval-in-background to nil disables the output" per above.
In addition, I am still getting timeouts when first loading ESSR process. Messages:
Loading ESSR into remote ...
ess-command: Timeout during background ESS command ‘{
##' Source FILE into an environment. After having a look at each new object in
##' the environment, decide what to do with it. Handles plain objects,
##' functions, existing S3 methods, S4 classes and methods.
##' @param fallback_env environment to assign objects which don't exist in the
##' package namespace
.ess.ns_source <- function(file, visibly, output, expr,
package = "", verbose = FALSE,
fake.source = FALSE,
fallback_env = NULL,
local_env = NULL) {
...
This is on the latest available ESS:
M-x ess-version:
ess-version: 18.10.3snapshot [elpa: 20210217.935] (loaded from
and the timeout is 30s, as expected in this new version:
C-h v ess--command-default-timeout
ess--command-default-timeout is a variable defined in ‘ess-inf.el’.
Its value is 30
Should be reported as a new bug. This one is already closed and it's not the same issue.
On Windows 10 / Emacs 27.1, 26.3 / ESS 20210126, I occasionally edit files on network drives, and run into some odd ESS behavior. It's hard to pin down the issue, but after working interactively with R scripts on network drives, the iESS buffer loses connection, and shows
no process
in the modeline.In the messages buffer, I can only find the phase
user-error: Current buffer has no process
. If I try to continue to interact with the broken process, I get the messageError running timer ‘ess--idle-timer-function’: (wrong-type-argument stringp nil)
When this happens I have to restart the R process, but I inevitably run into it again.
The ESS buffer shows the output
I've only run into this
no process
issue while working interactively with R scripts on network drives under Windows 10, but I'm not sure that's part of the problem.Here is my complete ESS configuration:
Maybe this is related to #1091?