GithubHelp home page GithubHelp logo

Comments (6)

jcheng5 avatar jcheng5 commented on August 10, 2024

It looks to me like a combination of how parallel is implemented (fork without exec), and something that libuv is using in CoreServices. I don't know what libuv actually uses but I know it wouldn't build on Mac until I linked in the CoreServices framework.

This explains the general problem: http://objectivistc.tumblr.com/post/16187948939/you-must-exec-a-core-foundation-fork-safety-tale

Sooner or later (probably within 2 months?) I am going to add a daemonize option to httpuv, it is needed for gigvis.

from httpuv.

jeroen avatar jeroen commented on August 10, 2024

Interesting. Thanks.

from httpuv.

jeroen avatar jeroen commented on August 10, 2024

What I don't understand is why it also happens when httpuv is only loaded in the forked child process, not in the parent process. So in this case, the CF process is not forked.

Also the error only appears when used in Rstudio. When running the above code snippet in a regular R session in the console on the same machine, I don't get to see this warning.

from httpuv.

jcheng5 avatar jcheng5 commented on August 10, 2024

The problem seems to occur whenever CF has been loaded in the parent process (whether by httpuv or anything else). So the Mac R GUI also triggers this problem; the reason it doesn't occur at the command line must be because no CF code is being loaded (which would not be very surprising).

Another link (the referenced Apple docs are instructive):
http://stackoverflow.com/questions/2707572/fork-within-cocoa-application

If you could exec the child process then it would be fine.

from httpuv.

jeroen avatar jeroen commented on August 10, 2024

Hmm alright. I asked @s-u for his 2ct, hope he can have a look.

from httpuv.

s-u avatar s-u commented on August 10, 2024

gdb is your friend:

#0  0x00007fff842a84f4 in __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__ ()
#1  0x00007fff841f46f5 in CFRunLoopSourceCreate ()
#2  0x0000000103d85b61 in uv__platform_loop_init (loop=0x103dae2c0, default_loop=0) at darwin.c:69
#3  0x0000000103d7b5da in uv__loop_init (loop=0x103dae2c0, default_loop=0) at loop.c:62
#4  0x0000000103d78c51 in uv_default_loop () at core.c:222
#5  0x0000000103d62c2c in makeServer (host=@0x7fff5fbf7908, port=1606383360, onHeaders=@0x0, onBodyData=@0x0, onRequest=@0x0, onWSOpen=@0x7fff5fbf7930, onWSMessage=@0x7fff5fbf7920, onWSClose=@0x7fff5fbf7910) at httpuv.cpp:327

as you can see httpuv is trying to run the CF event loop despite R_isForkedChild being set. Ideally, it should not be running the event loop itself but add a hook into the R event loop -- that would work, because R suspends the event loop when unsafe (e.g. while forked).

from httpuv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.