Blogdown serve-site() aborting R session

I have recently added a post to my blog and keep getting the session aborted

Even when I remove this latest post from the post folder I still get this occurring


Any suggestions on reason - or how I can investigate. There does not seem to be an explanation in the messages
p.s. It would be helpful if the abort window was moveable

TIA

I'm sure it's scattered across this site somewhere, but could you add in your versions, relevant specs, etc. (no clue what the answer is, but couldn't hurt to know what's what!)

Before I run blogdown::serve_site()

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252   
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2    yaml_2.1.14 

Not sure what else would help

Figure those might! Just thought I'd get those in here for when the real brains come to the table :wink:

I'd be worried that it will result in "Well if Mara can't fix it, it's insoluble"

Having not used blogdown before, I assumed that one of the previous builds left some dangling temporary file that was causing issues -- I've seen that in RMarkdown before. Not knowing what those temporary files could be, I downloaded blogdown, created a new site, and it promptly blew up R on the Windows 7 computer I have in front of me. Creating additional sites is touch-and-go; some blow up and some work fine.

It looks like a new build of blogdown hit CRAN on the 1st, and the Windows build was updated on the 5th. That seems like a good place to start investigating the problem.

@nick
Good point about blogdown update. I automatically updated a week ago and this is probably first time I have
created a new post and run serve_site since. No relevant issue on github at first glance so I guess i'll revert to earlier version and retry

Hey @pssguy, I'd try a few things. Please run serve_site() after each suggestion. But please rerun any previous suggestions as you go down the list:

  • Delete all of the contents in the public and blogdown folders
  • If you made a change in the themes or layout folders please back them out
  • If there's a blogdown folder, please empty it
  • Restart R, and maybe even your machine

Hope this helps.

@edgararuiz
Thanks for suggestions. Here is an update

Deleted public folder (as I would normally before running hugo_build)
The only blogdown folder I seem to have is the one with the package
Ran serve_site and crashed

I do not run the default theme but have been using icarus for months

Restarted computer (I always restart R anyways) and it worked Ok 1st time
However, when I added back the new post and re-ran serve_site it aborted again
There was a message something like this

stack imbalance in '<' 43 then 54 

With the new post, I cannot see any issues from just running all of its chunks

Does it work if you re-serve the same site multiple times without adding back in the new post? I was getting some inconsistency, which didn't seem to follow an obvious pattern in my brief debugging.

@nick
No you are right. I must have just struck 'lucky' first time. So it does not look like an issue with my new post(?)

The site does build. It appears in my RStudio viewer and I can open in browser but the session still crashes

UPDATE
Tried dev version of blogdown 0.2.2 (same result)
reverted to v 0.1 (the CRAN version until a week ago) and repeated serve_site() attempts all work

Creating a new site with blogdown::new_site() and then subsequently serving it with blogdown::serve_site(), I can eventually crash the R session by clicking on links repeatedly. Sometimes it's while loading the initial page, sometimes after I've clicked on a link up to about 10 times. I might get an error in the console, but it's different every time and doesn't always appear. This potentially appears to be a problem with servr, which I know nothing about.

Any ideas as to how we could narrow down the problem more, @edgararuiz?

@nick - It sounds like what you're describing is an issue that should be opened on the blogdown repo, would you mind doing that?

@nick @edgararuiz @yihui

OK so reverting back to 0.1 the serve_site functions performs fine and I can open all my posts locally

However when I attempt to run hugo_build (still on v 0,1 which has worked fine for months) only the front page gets created
UPDATE
reinstalled v 0.2 to see if hugo_build worked on that but no dice

Hopefully @nick writing an issue will work. I ducked out as I knew you would ask for a reproducible example and that is not that easy - especially when no errors are printed

Sure. I'll see if I can make it any more reproducible, but that sounds like a plan.

See footnote 10 in the blogdown book: https://bookdown.org/yihui/blogdown/rstudio-ide.html I'd recommend install.packages('later'). The same issue has been reported recently at https://github.com/rstudio/blogdown/issues/169#issuecomment-341949938

2 Likes

Sure, just when I had narrowed it down to servr::httd and whether daemon was true or false... :wink:

I can confirm that installing the later package fixes the problem.

@nick - glad to see your issue resolved

I have run this code

install.packages(c("processx", "later"))
options(blogdown.generator.server = TRUE)

Then restarted computer
blogdown::serve_site() v(0.2) appears to work fine. Looks good in RStudio viewer, opens in browser and i can click links to posts

blogdown::hugo_build() appears to run fine. No errors but a very small index.xml file (39,138 cf 13,612,366 on my remote site)
If I open the public/post/index.html file it works but of course links from it relate to the remote web site

I'm not clear where the post .html files are. Obviously I do not want to deploy and have all my 50+ posts disappear

@pssguy @nick Could you try to run the code below in RStudio and let me know the output?

(blogdown:::Rscript(c("-e", shQuote("httpuv::startDaemonizedServer('127.0.0.1', p <- servr:::random_port(), list(call = function(req) list(status = 200L, body = 'Hello world!', headers = list('Content-Type' = 'text/plain')))); readLines(paste0('http://127.0.0.1:', p), warn = F)"))))

The code is not malicious (trust me :wink:). I just wonder if there is a way to tell if the daemonized server could crash or not on your platform.

> (blogdown:::Rscript(c("-e", shQuote("httpuv::startDaemonizedServer('127.0.0.1', p <- servr:::random_port(), list(call = function(req) list(status = 200L, body = 'Hello world!', headers = list('Content-Type' = 'text/plain')))); readLines(paste0('http://127.0.0.1:', p), warn = F)"))))
[1] "382522256"
[1] "Hello world!"
[1] 0