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: socket back pressure memory leak #435

Merged
merged 2 commits into from
Sep 24, 2020
Merged

fix: socket back pressure memory leak #435

merged 2 commits into from
Sep 24, 2020

Conversation

ronag
Copy link
Member

@ronag ronag commented Sep 24, 2020

Fixes: #434

@ronag ronag added the bug Something isn't working label Sep 24, 2020
@ronag ronag requested a review from mcollina September 24, 2020 21:09
@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

@szmarczak

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

@mcollina I would very much like to make a release out of this as soon as possible.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Member

go for it!

@ronag ronag merged commit dfef1c6 into master Sep 24, 2020
@ronag ronag deleted the socket-back-pressure branch September 24, 2020 21:25
@szmarczak
Copy link
Member

Is socket[kBuffer] supposed to be null?

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

socket[kBuffer]? I don't think we have that?

@szmarczak
Copy link
Member

szmarczak commented Sep 24, 2020

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

Hm, I don't understand how that works at the moment unfortunately.

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

@mcollina Do we know someone that knows these internals well and we could ask for a quick review in regards to consume and socket.

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

Seems like whatever kBuffer does it's opt-in. nodejs/node#25436

@szmarczak
Copy link
Member

szmarczak commented Sep 24, 2020

I think @mcollina was right here: https://github.com/nodejs/node/pull/25436/files#diff-e6ef024c3775d787c38487a6309e491dR602 Overriding [public] Stream API sounds like a mistake.

@szmarczak
Copy link
Member

Why does it override .read() at all? Shouldn't it set ._read() instead?

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

Why does it override .read() at all? Shouldn't it set ._read() instead?

What overrides it?

@ronag
Copy link
Member Author

ronag commented Sep 24, 2020

I think @mcollina was right here: nodejs/node#25436 (files) Overriding [public] Stream API sounds like a mistake.

Where is that comment?

@szmarczak
Copy link
Member

Where is that comment?

lib/net.js after line 603

If you click the (files) link it should scroll down to the comment. It is marked as resolved so you need to click Show conversation.

Screenshot

image

What overrides it?

I'm still talking about Node.js core (lib/net.js file) 😅

image

Shouldn't it be:

-Socket.prototype.read = function(n) {
+Socket.prototype._read = function(n) {
  if (this[kBuffer] && !this.connecting && this._handle &&
      !this._handle.reading) {
    tryReadStart(this);
  }
- return stream.Duplex.prototype.read.call(this, n);
};

@ronag
Copy link
Member Author

ronag commented Sep 25, 2020

@szmarczak Yea, that's a bit weird... does it affect us though?

@ronag ronag mentioned this pull request Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leaking array buffers
3 participants