Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix race condition in debug signal on exit #3528

Merged
merged 1 commit into from
Oct 27, 2015

Commits on Oct 27, 2015

  1. src: fix race condition in debug signal on exit

    Before this commit, sending a SIGUSR1 at program exit could trigger a
    hard to reproduce race condition where `v8::Debug::DebugBreak(isolate)`
    got called when the isolate was in the process of being torn down.
    
    A similar race condition is in theory possible when sending signals
    to two threads simultaneously but I haven't been able to reproduce
    that myself (and I tried, oh how I tried.)
    
    This commit fixes the race condition by turning `node_isolate` into
    a `std::atomic` and using it as an ad hoc synchronization primitive
    in places where that is necessary.
    
    A bare minimum std::atomic polyfill is added for OS X because Apple
    wouldn't be Apple if things just worked out of the box.
    
    PR-URL: nodejs#3528
    Reviewed-By: Fedor Indutny <fedor@indutny.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    bnoordhuis committed Oct 27, 2015
    Configuration menu
    Copy the full SHA
    53e64bb View commit details
    Browse the repository at this point in the history