Skip to content

zlib: remove _closed#6574

Closed
addaleax wants to merge 2 commits into
nodejs:masterfrom
addaleax:zlib-remove-_closed
Closed

zlib: remove _closed#6574
addaleax wants to merge 2 commits into
nodejs:masterfrom
addaleax:zlib-remove-_closed

Conversation

@addaleax

@addaleax addaleax commented May 4, 2016

Copy link
Copy Markdown
Member
Checklist
  • tests and code linting passes
  • the commit message follows commit guidelines
Affected core subsystem(s)

zlib

Description of change

This is purely cleanup and carries no visible behavioural changes.
Up to now, this._closed was used in zlib.js as a synonym of !this._handle. This change makes this connection explicit and removes the _closed property from zlib streams, as the previous duplication has been the cause of subtle errors like #6034.

This also makes zlib errors lead to an explicit _close() call rather than waiting for garbage collection to clean up the handle, thus returning memory resources earlier in the case of an error.

CI: https://ci.nodejs.org/job/node-test-commit/3184/

This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like nodejs#6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.
@addaleax addaleax added the zlib Issues and PRs related to the zlib subsystem. label May 4, 2016
@cjihrig

cjihrig commented May 4, 2016

Copy link
Copy Markdown
Contributor

Even though this was an underscored property, it should probably still go through a deprecation cycle.

@Fishrock123 Fishrock123 added the semver-major PRs that contain breaking changes and should be released in the next major version. label May 4, 2016
@Trott

Trott commented May 4, 2016

Copy link
Copy Markdown
Member

You can de-semver-major-ize this PR by keeping ._closed but just not actually using it.

A separate PR can remove it (or print a deprecation warning if it's accessed, or whatever the correct first deprecation step is in this situation).

@addaleax

addaleax commented May 4, 2016

Copy link
Copy Markdown
Member Author

Eh, yes, I’m adding a getter for _closed then.

Add a getter for `_closed` so that the property remains accessible
by legacy code.
@addaleax

addaleax commented May 4, 2016

Copy link
Copy Markdown
Member Author

Done. The OS X CI failure looks very unrelated, but I don’t recall it being mentioned as flaky anywhere, if anyone’s curious.

@addaleax addaleax removed the semver-major PRs that contain breaking changes and should be released in the next major version. label May 4, 2016
@Trott

Trott commented May 4, 2016

Copy link
Copy Markdown
Member

OS X thing sure looks unrelated. Maybe run a second CI just to make sure? Stranger things have happened, although not often. :-)

@addaleax

addaleax commented May 4, 2016

Copy link
Copy Markdown
Member Author

@cjihrig

cjihrig commented May 4, 2016

Copy link
Copy Markdown
Contributor

LGTM if the CI is happy.

@jasnell

jasnell commented May 6, 2016

Copy link
Copy Markdown
Member

LGTM but if you happen to know of any modules that use zlib we may want to get those into citgm to make sure these kinds of changes don't have unintended drawbacks /cc @thealphanerd

@addaleax

addaleax commented May 8, 2016

Copy link
Copy Markdown
Member Author

Hmm… there are

each with > 500k npm downloads/month, I think that’s something?

@jasnell

jasnell commented May 8, 2016

Copy link
Copy Markdown
Member

Works for me!

@addaleax

Copy link
Copy Markdown
Member Author

I think this can be landed without an extra citgm run, but ping @thealphanerd … interested in adding the modules from above to the list?

@MylesBorins

MylesBorins commented May 11, 2016 via email

Copy link
Copy Markdown
Contributor

@addaleax

Copy link
Copy Markdown
Member Author

Oh, okay then, sorry for bothering. ;-)

@MylesBorins

MylesBorins commented May 11, 2016 via email

Copy link
Copy Markdown
Contributor

@addaleax

Copy link
Copy Markdown
Member Author

Landed in b53473f

@addaleax addaleax closed this May 17, 2016
@addaleax addaleax deleted the zlib-remove-_closed branch May 17, 2016 21:29
addaleax added a commit that referenced this pull request May 17, 2016
This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like #6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.

Add a getter for `_closed` so that the property remains accessible
by legacy code.

PR-URL: #6574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fishrock123 pushed a commit that referenced this pull request May 23, 2016
This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like #6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.

Add a getter for `_closed` so that the property remains accessible
by legacy code.

PR-URL: #6574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins

Copy link
Copy Markdown
Contributor

@addaleax lts?

rvagg pushed a commit that referenced this pull request Jun 2, 2016
This is purely cleanup and carries no visible behavioural changes.
Up to now, `this._closed` was used in zlib.js as a
synonym of `!this._handle`. This change makes this connection
explicit and removes the `_closed` property from zlib streams,
as the previous duplication has been the cause of subtle errors
like #6034.

This also makes zlib errors lead to an explicit `_close()` call
rather than waiting for garbage collection to clean up the handle,
thus returning memory resources earlier in the case of an error.

Add a getter for `_closed` so that the property remains accessible
by legacy code.

PR-URL: #6574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zlib Issues and PRs related to the zlib subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants