async_wrap: fix memory leak in AsyncResource#20668
Closed
mhdawson wants to merge 1 commit intonodejs:masterfrom
Closed
async_wrap: fix memory leak in AsyncResource#20668mhdawson wants to merge 1 commit intonodejs:masterfrom
mhdawson wants to merge 1 commit intonodejs:masterfrom
Conversation
Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: nodejs/node-addon-api#237
addaleax
approved these changes
May 11, 2018
Member
|
We might also want an option to toggle a weak/non-weak flag, like we have for references |
TimothyGu
approved these changes
May 11, 2018
Member
TimothyGu
left a comment
There was a problem hiding this comment.
I was going to ask if we could use node::Persistent instead, but then I realized that was an internal API. LGTM.
Member
|
Regrettably that's not going to fix the memory leak in already compiled add-ons since it's an inline definition. Can I suggest moving the method bodies to a .cc file? edit: to be clear, that won't fix the add-on issue right away either but it helps avoid such issues in the future. |
Member
Author
|
@bnoordhuis it should fix it for N-API addons since the inline should be behind the N-API c functions so I'd like to get it landed and do the refactoring as a follow on. |
gabrielschulhof
approved these changes
May 11, 2018
jasnell
approved these changes
May 12, 2018
jasnell
approved these changes
May 12, 2018
Member
Member
|
Landed in 1248ce1 |
addaleax
pushed a commit
that referenced
this pull request
May 14, 2018
Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: nodejs/node-addon-api#237 PR-URL: #20668 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax
pushed a commit
that referenced
this pull request
May 14, 2018
Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: nodejs/node-addon-api#237 PR-URL: #20668 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Merged
addaleax
added a commit
that referenced
this pull request
May 14, 2018
Notable Changes: * **addons**: - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) [#20668](#20668) * **assert**: - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) [#20485](#20485) * **crypto**: - The `authTagLength` option has been made more flexible. (Tobias Nießen) [#20235](#20235), [#20039](#20039) * **http**: - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) [#20075](#20075), [#20611](#20611) * Embedder support: - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (helloshuangzi) [#20639](#20639) - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) [#19377](#19377) - Support for multi-threaded embedding has been improved. (Anna Henningsen) [#20542](#20542), [#20539](#20539), [#20541](#20541) * **timers**: - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) [#20298](#20298) PR-URL: #20724
Member
Author
|
@addaleax thanks ! |
addaleax
added a commit
that referenced
this pull request
May 15, 2018
Notable Changes: * **addons**: - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) [#20668](#20668) * **assert**: - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) [#20485](#20485) * **crypto**: - The `authTagLength` option has been made more flexible. (Tobias Nießen) [#20235](#20235), [#20039](#20039) * **http**: - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) [#20075](#20075), [#20611](#20611) * Embedder support: - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (helloshuangzi) [#20639](#20639) - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) [#19377](#19377) - Support for multi-threaded embedding has been improved. (Anna Henningsen) [#20542](#20542), [#20539](#20539), [#20541](#20541) * **esm**: - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules. (Gus Caplan) [#20403](#20403) * **timers**: - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) [#20298](#20298) PR-URL: #20724
addaleax
added a commit
that referenced
this pull request
May 15, 2018
Notable Changes: * **addons**: - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) [#20668](#20668) * **assert**: - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) [#20485](#20485) * **crypto**: - The `authTagLength` option has been made more flexible. (Tobias Nießen) [#20235](#20235), [#20039](#20039) * **http**: - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) [#20075](#20075), [#20611](#20611) * Embedder support: - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (Allen Yonghuang Wang) [#20639](#20639) - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) [#19377](#19377) - Support for multi-threaded embedding has been improved. (Anna Henningsen) [#20542](#20542), [#20539](#20539), [#20541](#20541) * **esm**: - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules. (Gus Caplan) [#20403](#20403) * **timers**: - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) [#20298](#20298) PR-URL: #20724
MylesBorins
pushed a commit
that referenced
this pull request
May 22, 2018
* addons:
- Fixed a memory leak for users of `AsyncResource` and N-API.
(Michael Dawson)
#20668
* assert:
- The `error` parameter of `assert.throws()` can be an object containing
regular expressions now. (Ruben Bridgewater)
#20485
* crypto:
- The `authTagLength` option has been made more flexible (Tobias Nießen)
#20235)
#20039
* esm:
- Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
(Gus Caplan)
#20403
* http:
- Handling of `close` and `aborted` events has been made more consistent.
(Robert Nagy)
#20075
#20611
* module:
- add --preserve-symlinks-main (David Goldstein)
#19911
* timers:
- `timeout.refresh()` has been added to the public API.
(Jeremiah Senkpiel)
#20298
* Embedder support:
- Functions for creating V8 `Isolate` and `Context` objects with
Node.js-specific behaviour have been added to the API.
(Allen Yonghuang Wang)
#20639
- Node.js `Environment`s clean up resources before exiting now.
(Anna Henningsen)
#19377
- Support for multi-threaded embedding has been improved.
(Anna Henningsen)
#20542
#20539
#20541
PR-URL: #20724
MylesBorins
pushed a commit
that referenced
this pull request
May 23, 2018
* addons:
- Fixed a memory leak for users of `AsyncResource` and N-API.
(Michael Dawson)
#20668
* assert:
- The `error` parameter of `assert.throws()` can be an object containing
regular expressions now. (Ruben Bridgewater)
#20485
* crypto:
- The `authTagLength` option has been made more flexible (Tobias Nießen)
#20235)
#20039
* esm:
- Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
(Gus Caplan)
#20403
* http:
- Handling of `close` and `aborted` events has been made more consistent.
(Robert Nagy)
#20075
#20611
* module:
- add --preserve-symlinks-main (David Goldstein)
#19911
* timers:
- `timeout.refresh()` has been added to the public API.
(Jeremiah Senkpiel)
#20298
* Embedder support:
- Functions for creating V8 `Isolate` and `Context` objects with
Node.js-specific behaviour have been added to the API.
(Allen Yonghuang Wang)
#20639
- Node.js `Environment`s clean up resources before exiting now.
(Anna Henningsen)
#19377
- Support for multi-threaded embedding has been improved.
(Anna Henningsen)
#20542
#20539
#20541
PR-URL: #20724
MylesBorins
pushed a commit
that referenced
this pull request
May 23, 2018
* addons:
- Fixed a memory leak for users of `AsyncResource` and N-API.
(Michael Dawson)
#20668
* assert:
- The `error` parameter of `assert.throws()` can be an object containing
regular expressions now. (Ruben Bridgewater)
#20485
* crypto:
- The `authTagLength` option has been made more flexible (Tobias Nießen)
#20235)
#20039
* esm:
- Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
(Gus Caplan)
#20403
* http:
- Handling of `close` and `aborted` events has been made more consistent.
(Robert Nagy)
#20075
#20611
* module:
- add --preserve-symlinks-main (David Goldstein)
#19911
* timers:
- `timeout.refresh()` has been added to the public API.
(Jeremiah Senkpiel)
#20298
* Embedder support:
- Functions for creating V8 `Isolate` and `Context` objects with
Node.js-specific behaviour have been added to the API.
(Allen Yonghuang Wang)
#20639
- Node.js `Environment`s clean up resources before exiting now.
(Anna Henningsen)
#19377
- Support for multi-threaded embedding has been improved.
(Anna Henningsen)
#20542
#20539
#20541
PR-URL: #20724
MylesBorins
pushed a commit
that referenced
this pull request
May 23, 2018
* addons:
- Fixed a memory leak for users of `AsyncResource` and N-API.
(Michael Dawson)
#20668
* assert:
- The `error` parameter of `assert.throws()` can be an object containing
regular expressions now. (Ruben Bridgewater)
#20485
* crypto:
- The `authTagLength` option has been made more flexible (Tobias Nießen)
#20235)
#20039
* esm:
- Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
(Gus Caplan)
#20403
* http:
- Handling of `close` and `aborted` events has been made more consistent.
(Robert Nagy)
#20075
#20611
* module:
- add --preserve-symlinks-main (David Goldstein)
#19911
* timers:
- `timeout.refresh()` has been added to the public API.
(Jeremiah Senkpiel)
#20298
* Embedder support:
- Functions for creating V8 `Isolate` and `Context` objects with
Node.js-specific behaviour have been added to the API.
(Allen Yonghuang Wang)
#20639
- Node.js `Environment`s clean up resources before exiting now.
(Anna Henningsen)
#19377
- Support for multi-threaded embedding has been improved.
(Anna Henningsen)
#20542
#20539
#20541
PR-URL: #20724
Merged
MylesBorins
pushed a commit
that referenced
this pull request
Jul 9, 2018
Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: nodejs/node-addon-api#237 PR-URL: #20668 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Jul 10, 2018
Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: nodejs/node-addon-api#237 PR-URL: #20668 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
rvagg
pushed a commit
that referenced
this pull request
Aug 16, 2018
Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: nodejs/node-addon-api#237 PR-URL: #20668 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reset the persistent that keeps the resource
Object alive when the AsyncResource is being
destroyed.
Fixes: nodejs/node-addon-api#237
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes