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

Fix timer .unref() handle management once and for all #1330

Closed
wants to merge 5 commits into from

Commits on Apr 3, 2015

  1. timers: fix unref() memory leak

    The destructor isn't being called for timers that have been unref'd.
    
    Fixes: nodejs/node-v0.x-archive#8364
    trevnorris authored and indutny committed Apr 3, 2015
    Configuration menu
    Copy the full SHA
    340be32 View commit details
    Browse the repository at this point in the history
  2. timers: don't close interval timers when unrefd

    This change fixes a regression introduced by commit
    0d05123, which contained a typo that
    would cause every unrefd interval to fire only once.
    
    Fixes: nodejs/node-v0.x-archive#8900
    Reviewed-By: Timothy J Fontaine <[email protected]>
    Reviewed-By: Colin Ihrig <[email protected]>
    Reviewed-by: Trevor Norris <[email protected]>
    Julien Gilli authored and indutny committed Apr 3, 2015
    Configuration menu
    Copy the full SHA
    31d8801 View commit details
    Browse the repository at this point in the history
  3. timers: do not restart the interval after close

    Partially revert 776b73b.
    
    Following code crashes after backported timer leak fixes:
    
    ```javascript
    var timer = setInterval(function() {
      clearInterval(timer);
    }, 10);
    timer.unref();
    ```
    
    Note that this is actually tested in a `test-timers-unref.js`, and is
    crashing only with 776b73b.
    
    Calling `clearInterval` leads to the crashes in case of `.unref()`ed
    timers, and might lead to a extra timer spin in case of regular
    intervals that was closed during the interval callback. All of these
    happens because `.unref()`ed timer has it's own `_handle` and was used
    after the `.close()`.
    indutny committed Apr 3, 2015
    Configuration menu
    Copy the full SHA
    0b39408 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ca615ac View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    452571b View commit details
    Browse the repository at this point in the history