From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Trouble evaluating R source code blocks with C-c C-c Date: Mon, 30 May 2016 09:22:47 -0700 Message-ID: References: <2BE21056-50D3-49CE-8B0D-5467D182B7B5@agrarianresearch.org> <2E8B017B-F4AB-454D-81A1-E61F55F4F958@agrarianresearch.org> <5F862231-C04A-4BF6-8A2A-2377AF000374@agrarianresearch.org> <84824898-5690-4956-A4C6-EC20872896A6@agrarianresearch.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7Pxu-000722-Gz for emacs-orgmode@gnu.org; Mon, 30 May 2016 12:22:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7Pxq-0000Wp-9m for emacs-orgmode@gnu.org; Mon, 30 May 2016 12:22:53 -0400 Received: from iport-acv3-out.ucsd.edu ([132.239.0.4]:37671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7Pxp-0000W5-Ri for emacs-orgmode@gnu.org; Mon, 30 May 2016 12:22:50 -0400 In-Reply-To: <84824898-5690-4956-A4C6-EC20872896A6@agrarianresearch.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Vikas Rawal Cc: William Denton , org-mode mailing list On Mon, 30 May 2016, Vikas Rawal wrote: > Thanks. > > The code still seems to freeze. > > The backtrace now is. > OK, let me abbreviate this by cutting off the ends of long lines: > Debugger entered--Lisp error: (quit) > process-send-string(# ".ess.eval(\"lm(log_cal~sector+ [...] > ess-send-string--fallback(# ".ess.eval(\"lm(log_cal~ [...] > ess-send-string(# ".ess.eval(\"lm(log_cal~sector+sex+ [...] > ess-tracebug-send-region(# 1 1183 nil "Eval buffer" buffer) > ess-send-region(# 1 1183 nil "Eval buffer" buffer) > ess-eval-region(1 1183 nil "Eval buffer" buffer) > ess-eval-buffer(nil) > org-babel-R-evaluate-session("type2" "lm(log_cal~sector+sex+AgeChild+ [...] > org-babel-R-evaluate("type2" "lm(log_cal~sector+sex+AgeChild+AgeAdult+ [...] > org-babel-execute:R("lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+ [...] > org-babel-execute-src-block(nil) > org-babel-execute-src-block-maybe() > org-babel-execute-maybe() > org-babel-execute-safely-maybe() > run-hook-with-args-until-success(org-babel-execute-safely-maybe) > org-ctrl-c-ctrl-c(nil) > call-interactively(org-ctrl-c-ctrl-c nil nil) > command-execute(org-ctrl-c-ctrl-c) > And what you had previously was [using some abbreviations]: sit-for(0.25) org-babel-comint-eval-invisibly-and-wait-for-file("type2" [filename] [R command string] [...] org-babel-R-evaluate-session("type2" [R command string] ... org-babel-R-evaluate("type2" [R command string] ... org-babel-execute:R( [R command string] ... org-babel-execute-src-block(nil) org-babel-execute-src-block-maybe() org-babel-execute-maybe() org-babel-execute-safely-maybe() run-hook-with-args-until-success(org-babel-execute-safely-maybe) org-ctrl-c-ctrl-c(nil) call-interactively(org-ctrl-c-ctrl-c nil nil) command-execute(org-ctrl-c-ctrl-c) What you can see is that everything is the same right up to this line `org-babel-R-evaluate-session(...' but in the top (most recent) version ess-* functions are shown right up to process-send-string, which means that ess is still trying to complete its work. In the older (bottom) version ess is done and babel is waiting for the resulting file. This makes me wonder what R is doing. Can you check the activity monitor (you are on OS X, right?) and see what is happening? If the R code takes a long time to run and the R process is chewing up CPU or reading from/writing to disk this would explain it. If that isn't it, you might try to put in some checkpoints to see how far the R code got. I'd put something like cat("Starting",file="progress.txt") at the top of your src code and cat(".",file="progress.txt",append=TRUE) after every line and cat("Done\n",file="progress.txt",append=TRUE) after the last command at the very bottom. Then if the R code hangs somewhere you can open `progress.txt', count up the dots, and see where it got to. If that does not appeal to you, then profiling the R code might do. see ?Rprof. Finally, you aren't doing something exotic - like trying to run src blocks from a local buffer in a remote session - are you? If so, that adds a layer of complexity that needs discussion. HTH, Chuck