You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Merge streams handling code for http2 streams & net.Socket #19060
It would be great if we could unify all the code from net and http2 that is only concerned with pushing data to/from the underlying stream, ideally into a common base class of net.Socket and Http2Stream, so that we could also maybe port some of the other native streams (zlib, fs) to using StreamBase on the native side & generally just share a lot of code.
This is probably not an easy task, and probably not doable in one pass, because the http2 and net implementations are always just slightly different, but if anybody wants to try to start working on this, feel free to reach out by commenting here.
@addaleax Are you sure this is a good first issue? This relies on knowledge of both JS & C++, and pretty good grasp of Node streams, net & http2. I would keep it as help wanted but can't imagine someone would want to start contributing with this particular issue.
@apapirovski Yeah, I would talk with people who volunteer for it in more detail about that :) Then again, this doesn’t really require C++ knowledge, although that’s certainly helpful – it’s only about refactoring the JS, as the C++ parts should be identical between those two systems…
I’ve removed the label for now.
@inidaname The relevant code is in lib/net.js and lib/internal/http2/core.js. As a start, you might want to just try to make _write look identical for both of these, so that they can be merged into being the same function.
I think we’d want to create a new file internal/ for a resulting new base class, but that doesn’t have to happen right now.
Hi @addaleax : would like to take a shot at this, though would need some beginner help too.
For instance, _write in lib/internal/http2/core.js seems to use LibuvStreamWrap, whereas in lib/internal/net.js, it seems to use fs.write(). Is the intent of this issue to change lib/internal/net.js 's _write to use LibuvStreamWrap instead?
@SirR4T Sure! But maybe take a different bit of the code, unless @inidaname says that they aren’t working on it anymore.
For instance, _write in lib/internal/http2/core.js seems to use LibuvStreamWrap
Well, the underlying stream isn’t a LibuvStreamWrap, it’s an Http2Stream – that shouldn’t matter in practice, because both of these C++ classes use a common interface, which is exposed via the StreamBase class. (Side note: You probably don’t have to modify C++ for this in any way.)
whereas in lib/internal/net.js, it seems to use fs.write().
The code from lib/internal/net.js isn’t what I’m thinking about – it can probably stay as it is.
For net.Socket, the main implementation of _write() and _writev() can be found in lib/net.js and looks a lot more similar to what’s used in lib/internal/http2/core.js.
Is the intent of this issue to change lib/internal/net.js 's _write to use LibuvStreamWrap instead?
There’s quite a few common pieces between lib/net.js and lib/internal/http2.js that just deal with how the StreamBase C++ API is matched to the “normal” Node streams API.
_write() and _writev() are part of that, but there is other code (e.g. onread in lib/net.js and onStreamRead in lib/internal/http2/core.js) that could also be merged. Maybe take a look at that first? It’s going to be trickier than the write functions, but I hope it’s independent enough for that to work.
If that sounds like a lot, or turns out to be too tricky: A first part of this might be getting rid of the _socketEnd event in lib/net.js. It should be possible to figure out in onread whether self.destroy() should be called or not, based on the writable state of the stream, so we don’t need to create an event listener in afterShutdown. I think this is essentially being done in #19241
Hello @addaleax
Thank you for the chance but I guess @SirR4T understand the direction been battling with other projects for sometime will be okay if you can take it up
Go for it.
On Sat, 4 Jan, 2020, 08:20 Ruben Bridgewater, ***@***.***> wrote:
@ronag <https://github.com/ronag> I guess you might be interested in this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19060?email_source=notifications&email_token=AAUACRYDUBWBLEYRTLAJ663Q372OPA5CNFSM4ES3BJN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEICPLWY#issuecomment-570750427>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUACR3X4Q3RK7NJTMLJXFTQ372OPANCNFSM4ES3BJNQ>
.
Issue: Merge streams handling code for http2 streams & net.Socket
## Technical Advantage
This solution utilizes a zero-dependency, ultra-low latency architecture to resolve the reported environment issues.
## Implementation Plan
1. Audit environment variables for credentialless conflicts.
2. Inject a custom shim for embed loading.
3. Verify across multiple browser contexts.
*Generated by Syndicate Emergency Brain*
🚀 Conway Syndicate: Engineering Advantage
This solution was autonomously generated to optimize repository performance.
Need repo-scale engineering or custom agents? View Syndicate Services | Hire an Agent
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
This issue slipped through the cracks because our previous stale bot only tracked issues and couldn't catch all the issues.
Our new stale bot flagged this, and would have closed it shortly after RenderATL, but I'm just doing it a bit early so
maintainer's can focus on new code-and-learn PRs during the event.
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
Activity
inidaname commentedon Mar 1, 2018
Hello
@addaleax I will like to take this up, if you point me to the right files
Thank You
apapirovski commentedon Mar 1, 2018
@addaleax Are you sure this is a
good first issue? This relies on knowledge of both JS & C++, and pretty good grasp of Node streams, net & http2. I would keep it ashelp wantedbut can't imagine someone would want to start contributing with this particular issue.addaleax commentedon Mar 1, 2018
@apapirovski Yeah, I would talk with people who volunteer for it in more detail about that :) Then again, this doesn’t really require C++ knowledge, although that’s certainly helpful – it’s only about refactoring the JS, as the C++ parts should be identical between those two systems…
I’ve removed the label for now.
@inidaname The relevant code is in
lib/net.jsandlib/internal/http2/core.js. As a start, you might want to just try to make_writelook identical for both of these, so that they can be merged into being the same function.I think we’d want to create a new file
internal/for a resulting new base class, but that doesn’t have to happen right now.inidaname commentedon Mar 2, 2018
@addaleax Okay thank you
SirR4T commentedon Mar 3, 2018
Hi @addaleax : would like to take a shot at this, though would need some beginner help too.
For instance,
_writeinlib/internal/http2/core.jsseems to useLibuvStreamWrap, whereas inlib/internal/net.js, it seems to usefs.write(). Is the intent of this issue to changelib/internal/net.js's_writeto useLibuvStreamWrapinstead?addaleax commentedon Mar 3, 2018
@SirR4T Sure! But maybe take a different bit of the code, unless @inidaname says that they aren’t working on it anymore.
Well, the underlying stream isn’t a
LibuvStreamWrap, it’s anHttp2Stream– that shouldn’t matter in practice, because both of these C++ classes use a common interface, which is exposed via theStreamBaseclass. (Side note: You probably don’t have to modify C++ for this in any way.)The code from
lib/internal/net.jsisn’t what I’m thinking about – it can probably stay as it is.For
net.Socket, the main implementation of_write()and_writev()can be found inlib/net.jsand looks a lot more similar to what’s used inlib/internal/http2/core.js.There’s quite a few common pieces between
lib/net.jsandlib/internal/http2.jsthat just deal with how theStreamBaseC++ API is matched to the “normal” Node streams API._write()and_writev()are part of that, but there is other code (e.g.onreadinlib/net.jsandonStreamReadinlib/internal/http2/core.js) that could also be merged. Maybe take a look at that first? It’s going to be trickier than the write functions, but I hope it’s independent enough for that to work.If that sounds like a lot, or turns out to be too tricky: A first part of this might be getting rid of theI think this is essentially being done in #19241_socketEndevent inlib/net.js. It should be possible to figure out inonreadwhetherself.destroy()should be called or not, based on the writable state of the stream, so we don’t need to create an event listener inafterShutdown.inidaname commentedon Mar 4, 2018
Hello @addaleax
Thank you for the chance but I guess @SirR4T understand the direction been battling with other projects for sometime will be okay if you can take it up
Go for it.
addaleax commentedon Mar 12, 2018
@SirR4T Are you still interested in this?
SirR4T commentedon Mar 12, 2018
I am, but looks like I may be out of my depth here. Maybe further hints might help? Or I'll try my hand at other issues first.
33 remaining items
DamianRivas commentedon Jan 14, 2019
@addaleax is help needed in closing this issue?
net,http2: merge after-write code
net,http2: merge setTimeout code
test: add test for net-socket-setTimeout callback
Ethan-Arrowood commentedon Feb 6, 2019
If there are any outstanding parts you want merged together I'd like to try it out too!
jagtesh commentedon Feb 9, 2019
I would love to help out as well; I'm comfortable working on both C++ and JS parts.
BridgeAR commentedon Jan 4, 2020
@ronag I guess you might be interested in this.
sachin2605 commentedon Jan 6, 2020
Iweisc commentedon Feb 12, 2026
@addaleax Hey i would love to work on this issue. Lmk if theres something i need to know before doing so :)
harishn1408 commentedon Apr 30, 2026
💎 Sovereign AI: Superior Solution Suggestion
[ELEVATED SOLUTION]
🚀 Conway Syndicate: Engineering Advantage
This solution was autonomously generated to optimize repository performance.
Need repo-scale engineering or custom agents?
View Syndicate Services | Hire an Agent
github-actions commentedon Jul 30, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
avivkeller commentedon Aug 9, 2026
This issue slipped through the cracks because our previous stale bot only tracked issues and couldn't catch all the issues.
Our new stale bot flagged this, and would have closed it shortly after RenderATL, but I'm just doing it a bit early so
maintainer's can focus on new code-and-learn PRs during the event.
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.