Code Monkey home page Code Monkey logo

libuv's People

Contributors

addaleax avatar apaprocki avatar bnoordhuis avatar bradking avatar bzoz avatar cjihrig avatar devnexen avatar dmabupt avatar erickt avatar henryrawas avatar indutny avatar isaacs avatar jbarz avatar jedisct1 avatar mmalecki avatar mscdex avatar orangemocha avatar piscisaureus avatar raisinten avatar richardlau avatar saghul avatar santigimeno avatar schlamar avatar tjfontaine avatar trevnorris avatar twose avatar txdv avatar vtjnash avatar zerhacken avatar zsw007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libuv's Issues

usage of vfork() is non-compliant

  • Version: julia-uv2-1.44.1
  • Platform: linux

Julia version of libuv uses vfork() for uv_spawn() implementation, but contrary to vfork() manpage it manages file descriptors and signal handlers prior to calling exec(). This might work fine with vanilla kernel/libc, but breaks in our environment. We use custom code for accelerated network sockets, which breaks when the child process shares address space with the parent process.

https://github.com/JuliaLang/libuv/blob/julia-uv2-1.44.1/src/unix/process.c#L990

Standard description
       (From POSIX.1) The vfork() function has the same effect as
       fork(2), except that the behavior is undefined if the process
       created by vfork() either modifies any data other than a variable
       of type pid_t used to store the return value from vfork(), or
       returns from the function in which vfork() was called, or calls
       any other function before successfully calling _exit(2) or one of
       the exec(3) family of functions.

uv_spawn probably blocks too many signals

We briefly block all signals during fork, because unix is often really bad at handling them during this call. However, we're blocking everything, and that's perhaps too much since it means buggy OS code (probably an atfork handler) can get us wedged. For example, I recorded us getting stuck here on my 10.14.6 laptop: Darwin Jameson.local 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x00007fff5f80a9e2 libdispatch.dylib`_firehose_task_buffer_init + 32
    frame #1: 0x00007fff5f7ea63d libdispatch.dylib`_dispatch_client_callout + 8
    frame #2: 0x00007fff5f7ebd4b libdispatch.dylib`_dispatch_once_callout + 20
    frame #3: 0x00007fff5f808b77 libdispatch.dylib`voucher_activity_get_metadata_buffer + 100
    frame #4: 0x00007fff5fa44163 libsystem_trace.dylib`_os_trace_init_slow + 94
    frame #5: 0x00007fff5f7ea63d libdispatch.dylib`_dispatch_client_callout + 8
    frame #6: 0x00007fff5f7ebd4b libdispatch.dylib`_dispatch_once_callout + 20
    frame #7: 0x00007fff5fa45f17 libsystem_trace.dylib`os_log_type_enabled + 463
    frame #8: 0x00007fff5deddf00 libnetwork.dylib`nw_path_close_fd + 144

We should probably avoid blocking anything that shouldn't be deferred (esp. SIGILL, SIGABRT, SIGSYS, SIGSEGV, SIGFPE, etc.) although nothing we do (except perhaps avoiding fork altogether by using vfork and/or posix_spawn+VFORK) is going to make this entirely reliable.

Note: prior to this, this had been spewing messages like the following during prior (successful) uv_spawn calls (many times, but it was an earlier process):

2019-12-21 00:01:51.006900-0500 julia-debug[17119:785417] nw_path_close_fd Failed to close guarded necp fd 43 [9: Bad file descriptor]

Hopefully this info helps someone on Google, since this appears to not be an uncommon issue for the past 2 years.

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.