rstudio / httpuv

HTTP and WebSocket server package for R
Other
229 stars 86 forks source link

libuv dependency on CoreFoundation #22

Closed jeroen closed 10 years ago

jeroen commented 11 years ago

This issue is closely related to https://github.com/rstudio/httpuv/issues/6 but slightly different in the fact that it also appears if outside of R.app.

Edit: a video that shows what happens on Mavericks: http://youtu.be/ZUfudbP1quA

Since the upgrade to Mavericks, the dependency of libuv on CF has gotten more problematic for me, because libcurl is now using CF as well. This puts a lot of restrictions on the ability to fork and do parallel processing. See also this thread.

I'm obviously not an expert on libuv or CF, but judging from some recent commits and announcements 1, 2, 3 it looks like in the latest release of libuv, The ApplicationServices, CoreFoundation and CoreServices frameworks are no longer required dependencies on OS X. Would that solve anything?

Here is a small example that works fine on linux, but if you run it on osx, it will crash child process, and the parent is having issues as well after the incident (it looks like it can no longer call fork or exec):

library(parallel)
library(httpuv)

runServer("0.0.0.0", 12345, list(call=function(req){
  myfork <- mcparallel({
    library(RCurl);
    getURL("https://api.github.com")
  })

  out <- mccollect(myfork)[[1]];

  list(
    status = 200,
    headers = list("Content-Type"="text/plain"),
    body = out
  );

}));
jcheng5 commented 10 years ago

Sorry, not ignoring you on purpose, I was heads down this week helping JJ with the RStudio Mavericks rewrite. I'm way behind you on this, my Mavericks machine isn't even building Rcpp successfully yet.

That being said, the announcements you linked to don't decrease the dependency on these frameworks, it just means they're loaded dynamically. So I wouldn't get your hopes too high, unfortunately.

jeroen commented 10 years ago

No worries, first things first. I've released an update for opencpu that disables forking on osx and instead uses psock nodes for parallel requests (windows style!). It's a bit of a performance killer, but hopefully temporary. Maybe once things have calmed down a bit, we can talk with @s-u to see if there is a proper solution to use httpuv with mcparallel.