[ESS] R-Markdown Locks up in Polymode/ESS
Laurent Gatto
|g390 @end|ng |rom c@m@@c@uk
Tue Jan 26 17:30:12 CET 2016
Dear all,
With the help of Stephen Eglen, I have managed to simplify Bill's
example Rmd file and provide an environment to reproduce the error. All
code chunks/files below are available in a github gist.
https://gist.github.com/lgatto/448133db50f31380bbb7
1) Produce the testing environment
emacs -Q
M-x load-file /path/to/installs.el
where installs.el contains
;; install the neccessary packages.
;; we install the required packages from MELPA into a fresh (temporary)
;; directory t
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(setq package-user-dir (expand-file-name "~/fmp"))
(package-initialize)
;; The following three packages should be installed:
;; ess polymode markdown-mode
;; by e.g.:
;; M-x package-install RET ess RET
and install packages
M-x package-install RET ess RET
M-x package-install RET polymode RET
M-x package-install RET markdown-mode RET
close emacs
At the time of writing, this installs
ess-version: 15.09-2 patched [elpa: 20160126.213]
markdown-mode 20160121.528
polymode 20151216.533
2) Reproduce the problem
emacs -Q
M-x load-file /path/to/emacs-test.el
where emacs-test.el contains
(setq package-user-dir (expand-file-name "~/fmp"))
(require 'package)
(package-initialize)
(require 'ess-site)
(require 'poly-R)
(require 'poly-markdown)
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
Open test.Rmd, containing
```{r}
data.frame(start=c(0, 0),
end=c(24, Inf),
cmax=c(FALSE, TRUE),
tmax=c(FALSE, TRUE),
auclast=TRUE,
aucinf=c(FALSE, TRUE))
```
hello world
## foo
## bar
move to the code chunk, before data.frame, start editing... and after a
couple of seconds, emacs will freeze and the emacs process will ramp up
to 100% cpu usage. The only way to terminate emacs is to kill it.
As mentioned in a previous email, tracing the system calls does not
reveal anything for me, but others are surely more knowledgeable. I
first get the emacs process id, and then call strace
ps aux | grep emacs
sudo strace -p 29189 | less
Here's a representative strace output
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
rt_sigreturn() = 31935264
recvmsg(4, {msg_name(0)=NULL, msg_iov(1)=[{"\6\0\371X\372\355\367\24\235\0\0\0\302\0@\1\0\0\0\0\245\4\255\0\343\0Z\0\0\0\1\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(4, 0x7fff2442b490, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
recvmsg(4, 0x7fff2442b490, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
I use GNU Emacs 24.5.1.
Hope this helps.
Best wishes,
Laurent
On 25 January 2016 04:25, Bill Denney wrote:
> I now have a reproducible example. When I start typing in the last code
> chunk of this file, it crashes. What I want to be there is
>
>
>
> ```{r}
>
> intervals <-
>
> data.frame(start=c(0, 0), end=c(24, Inf),
>
> cmax=c(FALSE, TRUE),
>
> tmax=c(FALSE, TRUE),
>
> auclast=TRUE,
>
> aucinf=c(FALSE, TRUE))
>
> ```
>
>
>
> I start by typing "intervals" right before "data.frame", and emacs takes
> 100% of the CPU.
>
>
>
> Thanks,
>
>
>
> Bill
>
>
>
> -----Original Message-----
> From: Laurent Gatto [mailto:lg390 using cam.ac.uk]
> Sent: Monday, January 18, 2016 4:28 PM
> To: ess-help using r-project.org
> Cc: Bill Denney <bill using denney.ws>
> Subject: Re: [ESS] R-Markdown Locks up in Polymode/ESS
>
>
>
>
>
> Dear Bill,
>
>
>
> I think I am experiencing the same problem here; I have this recurring issue
> with emacs, that has become serious since I updated all my package. When I
> edit an Rmarkdown file emacs randomly freezes and the emacs process takes up
> 100% of the CPU.
>
>
>
> As far as I can remember, this happens when I'm editing code chunks. I am
> not really sure what happens or what package is the problem. I just observed
> that this still happens when I don't load markdown-mode.
>
>
>
> I strace'd the emacs process after a freeze - here is a short representative
> extract.
>
>
>
> poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
>
> recvmsg(4, 0x7fffe86bc3a0, 0) = -1 EAGAIN (Resource temporarily
> unavailable)
>
> poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
>
> --- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
>
> rt_sigreturn() = 195
>
> recvmsg(4, {msg_name(0)=NULL,
> msg_iov(1)=[{"\6\0\236\306\316H\340\0\235\0\0\0\302\0@\1\0\0\0\0\306\4o\3
> \3\26\3\0\0\1\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
>
> recvmsg(4, 0x7fffe86bc6f0, 0) = -1 EAGAIN (Resource temporarily
> unavailable)
>
> poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
> poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
>
> recvmsg(4, 0x7fffe86bc6f0, 0) = -1 EAGAIN (Resource temporarily
> unavailable)
>
> poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}], 2, 0) = 0 (Timeout)
>
> --- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
>
> rt_sigreturn() = 10986603
>
>
>
> I have observed this recvmsg and timeouts/Resources temporarily unavailable
> several times in such situations, but I can't make any sense of this.
>
>
>
> Here are the respective versions
>
>
>
> markdown-mode 20160113.816
>
> polymode 20151216.533
>
> ess-version: 15.09-2 patched [elpa: 20160110.2313]
>
> GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of
> 2015-07-27
>
>
>
> Not of much help, but hopefully someone else will be able provide some.
>
>
>
> Best wishes,
>
>
>
> Laurent
>
>
>
> On 18 January 2016 16:43, Bill Denney wrote:
>
>
>
>> Hi,
>
>>
>
>>
>
>>
>
>> I've just started taking advantage of the benefits of polymode and ESS
>
>> combined for r-markdown documents having previously manually coded them.
>
>> I'm using them to make a vignette for the PKNCA package, and when I
>
>> scroll through the .Rmd file, emacs locks up when leaving the first
>
>> code block after I make an edit in the block. It fully locks up, and
>
>> I can't switch to the messages buffer in emacs to see the reason for the
> hang.
>
>>
>
>>
>
>>
>
>> Here are the steps to reproduce the error as I'm using it.
>
>>
>
>>
>
>>
>
>> Windows 10 (up to date)
>
>>
>
>> Emacs version: GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11
>
>>
>
>> ESS version: ess-version: 15.09-2 [Released git: 01328e83039f]
>
>>
>
>> Polymode installed via MELPA yesterday: version 20151216.533 as
>
>> described by MELPA
>
>>
>
>> Markdown-mode installed via MELPA yesterday: version 20160115.2318 as
>
>> described by MELPA
>
>>
>
>>
>
>>
>
>> 1. Load the file in emacs
>
>>
>
>> 2. Scroll down to the first code block (see below my signature for
> the
>
>> snippet)
>
>>
>
>> 3. Change "addlastrow" to "setpredose" (I have no R buffers open)
>
>>
>
>> 4. Scroll out of the code block
>
>>
>
>>
>
>>
>
>> As I do step 4, it locks up. This is unfortunately not fully
>
>> reproducible, and I can't figure out the specific trigger that changes
>
>> it from working normally to hanging. With previous experience, it
>
>> looks similar to an attempted function argument lookup hang, but that is
> mostly a guess.
>
>>
>
>>
>
>>
>
>> Any thoughts to what this could be or ways that I could improve the
>
>> bug report with better tracking of how it hangs?
>
>>
>
>>
>
>>
>
>> Thanks,
>
>>
>
>>
>
>>
>
>> Bill
>
>>
>
>>
>
>>
>
>> File snippet:
>
>>
>
>>
>
>>
>
>> Two examples are given below.
>
>>
>
>>
>
>>
>
>> ```{r eval=FALSE}
>
>>
>
>> list(operation="add",
>
>>
>
>> FUN=addlastrow)
>
>>
>
>> ```
>
>>
>
>>
>
>> [[alternative HTML version deleted]]
>
>>
>
>> ______________________________________________
>
>> <mailto:ESS-help using r-project.org> ESS-help using r-project.org mailing list
>
>> <https://stat.ethz.ch/mailman/listinfo/ess-help>
> https://stat.ethz.ch/mailman/listinfo/ess-help
More information about the ESS-help
mailing list